1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 23:17:59 +01:00

change all references to "settings" to "options"

This commit is contained in:
Doug Kearns
2007-06-06 15:32:11 +00:00
parent bc717bdc24
commit 5e2bd9cecb
7 changed files with 95 additions and 96 deletions

View File

@@ -414,7 +414,7 @@ function Commands()//{{{
"Make sure you use the full vim notation when jumping to {subject}. This means:<br/>"+ "Make sure you use the full vim notation when jumping to {subject}. This means:<br/>"+
"<ul>"+ "<ul>"+
"<li><code class=\"command\">:help :help</code> for commands (: prefix)</li>"+ "<li><code class=\"command\">:help :help</code> for commands (: prefix)</li>"+
"<li><code class=\"command\">:help 'complete'</code> for settings (surrounded by ' and ')</li>"+ "<li><code class=\"command\">:help 'complete'</code> for options (surrounded by ' and ')</li>"+
"<li><code class=\"command\">:help o</code> for mappings (no pre- or postfix)</li>"+ "<li><code class=\"command\">:help o</code> for mappings (no pre- or postfix)</li>"+
"</ul>"+ "</ul>"+
"You can however use partial stings in the tab completion, so <code class=\"command\">:help he&lt;Tab&gt;</code> will complete <code class=\"command\">:help :help</code>.", "You can however use partial stings in the tab completion, so <code class=\"command\">:help he&lt;Tab&gt;</code> will complete <code class=\"command\">:help :help</code>.",
@@ -494,14 +494,14 @@ function Commands()//{{{
"<li>Opened with the specified search engine if the token looks like a search string "+ "<li>Opened with the specified search engine if the token looks like a search string "+
"and the first word of the token is the name of a search engine (<code class=\"command\">:open wikipedia linus torvalds</code> "+ "and the first word of the token is the name of a search engine (<code class=\"command\">:open wikipedia linus torvalds</code> "+
"will open the wikipedia entry for linux torvalds).</li>"+ "will open the wikipedia entry for linux torvalds).</li>"+
" <li>Opened with the default search engine or keyword (specified with the <code class=\"setting\">'defsearch'</code> setting) "+ " <li>Opened with the default search engine or keyword (specified with the <code class=\"option\">'defsearch'</code> option) "+
"if the first word is no search engine (<code class=\"command\">:open linus torvalds</code> will open a google search for linux torvalds).</li>"+ "if the first word is no search engine (<code class=\"command\">:open linus torvalds</code> will open a google search for linux torvalds).</li>"+
" <li>Passed directly to Firefox in all other cases (<code class=\"command\">:open www.osnews.com | www.slashdot.org</code> will "+ " <li>Passed directly to Firefox in all other cases (<code class=\"command\">:open www.osnews.com | www.slashdot.org</code> will "+
"open OSNews in the current, and Slashdot in a new background tab).</li>"+ "open OSNews in the current, and Slashdot in a new background tab).</li>"+
"</ol>"+ "</ol>"+
"You WILL be able to use <code class=\"command\">:open [-T \"linux\"] torvalds&lt;Tab&gt;</code> to complete bookmarks "+ "You WILL be able to use <code class=\"command\">:open [-T \"linux\"] torvalds&lt;Tab&gt;</code> to complete bookmarks "+
"with tag \"linux\" and which contain \"torvalds\". Note that -T support is only available for tab completion, not for the actual command.<br/>"+ "with tag \"linux\" and which contain \"torvalds\". Note that -T support is only available for tab completion, not for the actual command.<br/>"+
"The items which are completed on <code>&lt;Tab&gt;</code> are specified in the <code class=\"setting\">'complete'</code> option.<br/>"+ "The items which are completed on <code>&lt;Tab&gt;</code> are specified in the <code class=\"option\">'complete'</code> option.<br/>"+
"Without argument, reloads the current page.<br/>"+ "Without argument, reloads the current page.<br/>"+
"Without argument but with !, reloads the current page skipping the cache.", "Without argument but with !, reloads the current page skipping the cache.",
completer: function(filter) { return get_url_completions(filter); } completer: function(filter) { return get_url_completions(filter); }
@@ -584,7 +584,7 @@ function Commands()//{{{
"<code class=\"command\">:set option?</code> or <code class=\"command\">:set option</code> shows the current value of the option.<br/>"+ "<code class=\"command\">:set option?</code> or <code class=\"command\">:set option</code> shows the current value of the option.<br/>"+
"<code class=\"command\">:set option&amp;</code> resets 'option' to the default value.<br/>"+ "<code class=\"command\">:set option&amp;</code> resets 'option' to the default value.<br/>"+
"<code class=\"command\">:set option+=foo</code> and <code class=\"command\">:set option-=foo</code> WILL add/remove foo from list options.<br/>", "<code class=\"command\">:set option+=foo</code> and <code class=\"command\">:set option-=foo</code> WILL add/remove foo from list options.<br/>",
completer: function(filter) { return get_settings_completions(filter); } completer: function(filter) { return get_options_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["so[urce]"], addDefaultCommand(new Command(["so[urce]"],
@@ -652,7 +652,7 @@ function Commands()//{{{
usage: ["tabopen [url] [| url]"], usage: ["tabopen [url] [| url]"],
short_help: "Open one or more URLs in a new tab", short_help: "Open one or more URLs in a new tab",
help: "Like <code class=\"command\">:open</code> but open URLs in a new tab.<br/>"+ help: "Like <code class=\"command\">:open</code> but open URLs in a new tab.<br/>"+
"If used with !, the 'tabopen' value of the 'activate' setting is negated.", "If used with !, the 'tabopen' value of the 'activate' option is negated.",
completer: function (filter) { return get_url_completions(filter); } completer: function (filter) { return get_url_completions(filter); }
} }
)); ));
@@ -1517,15 +1517,15 @@ function set(args, special)
var no = true; if (matches[1] == undefined) no = false; var no = true; if (matches[1] == undefined) no = false;
var opt = matches[2]; var opt = matches[2];
var setting = get_setting(opt); var option = get_option(opt);
if (!setting) if (!option)
{ {
vimperator.echoerr("E518: Unknown option: " + opt); vimperator.echoerr("E518: Unknown option: " + opt);
return; return;
} }
var get = false; if (matches[3] == "?" || var get = false; if (matches[3] == "?" ||
(setting[TYPE] != 'boolean' && matches[4] == undefined)) get = true; (option[TYPE] != 'boolean' && matches[4] == undefined)) get = true;
var reset = false; if (matches[3] == "&") reset = true; var reset = false; if (matches[3] == "&") reset = true;
var oper = matches[5]; var oper = matches[5];
var val = matches[6]; if (val == undefined) val = ""; var val = matches[6]; if (val == undefined) val = "";
@@ -1533,42 +1533,42 @@ function set(args, special)
// reset a variable to its default value. // reset a variable to its default value.
if (reset) if (reset)
{ {
var def = setting[DEFAULT]; var def = option[DEFAULT];
setting[SETFUNC].call(this, def); option[SETFUNC].call(this, def);
} }
// read access // read access
else if (get) else if (get)
{ {
var cur_val = setting[GETFUNC].call(this); var cur_val = option[GETFUNC].call(this);
vimperator.echo(" " + setting[COMMANDS][0] + "=" + cur_val); vimperator.echo(" " + option[COMMANDS][0] + "=" + cur_val);
} }
// write access // write access
else else
{ {
var type = setting[TYPE]; var type = option[TYPE];
if (type == "boolean") if (type == "boolean")
{ {
setting[SETFUNC].call(this, !no); option[SETFUNC].call(this, !no);
} }
else if (type == "number") else if (type == "number")
{ {
var num = parseInt(val, 10); var num = parseInt(val, 10);
if (isNaN(num)) if (isNaN(num))
vimperator.echoerr("Invalid argument type to option " + setting[COMMANDS][0] + ": Expects number"); vimperator.echoerr("Invalid argument type to option " + option[COMMANDS][0] + ": Expects number");
else else
{ {
var cur_val = setting[GETFUNC].call(this); var cur_val = option[GETFUNC].call(this);
if (oper == '+') num = cur_val + num; if (oper == '+') num = cur_val + num;
if (oper == '-') num = cur_val - num; if (oper == '-') num = cur_val - num;
if (setting[CHECKFUNC] != null && setting[CHECKFUNC].call(this, num) == false) if (option[CHECKFUNC] != null && option[CHECKFUNC].call(this, num) == false)
vimperator.echoerr("Invalid argument to option " + setting[COMMANDS][0] + ": Check help for more details"); vimperator.echoerr("Invalid argument to option " + option[COMMANDS][0] + ": Check help for more details");
else // all checks passed, execute option handler else // all checks passed, execute option handler
setting[SETFUNC].call(this, num); option[SETFUNC].call(this, num);
} }
} }
else if (type == "charlist" || type == "stringlist" || type == "string") else if (type == "charlist" || type == "stringlist" || type == "string")
{ {
var cur_val = setting[GETFUNC].call(this); var cur_val = option[GETFUNC].call(this);
if (type == "charlist" || type == "string") if (type == "charlist" || type == "string")
{ {
if (oper == '+' && !cur_val.match(val)) if (oper == '+' && !cur_val.match(val))
@@ -1585,10 +1585,10 @@ function set(args, special)
val = val.replace(/^,?/, ''); val = val.replace(/^,?/, '');
} }
} }
if (setting[CHECKFUNC] != null && setting[CHECKFUNC].call(this, val) == false) if (option[CHECKFUNC] != null && option[CHECKFUNC].call(this, val) == false)
vimperator.echoerr("Invalid argument to option " + setting[COMMANDS][0] + ": Check help for more details"); vimperator.echoerr("Invalid argument to option " + option[COMMANDS][0] + ": Check help for more details");
else // all checks passed, execute option handler else // all checks passed, execute option handler
setting[SETFUNC].call(this, val); option[SETFUNC].call(this, val);
} }
else else
vimperator.echoerr("Internal error, option format `" + type + "' not supported"); vimperator.echoerr("Internal error, option format `" + type + "' not supported");

View File

@@ -255,7 +255,7 @@ function get_help_completions(filter)/*{{{*/
{ {
var help_array = [[["mappings"], "Normal mode commands"], var help_array = [[["mappings"], "Normal mode commands"],
[["commands"], "Ex commands"], [["commands"], "Ex commands"],
[["settings"], "Configuration options"]]; // TODO: hardcoded until we have proper 'pages' [["options"], "Configuration options"]]; // TODO: hardcoded until we have proper 'pages'
g_substrings = []; g_substrings = [];
for (var command in vimperator.commands) for (var command in vimperator.commands)
{ {
@@ -264,8 +264,8 @@ function get_help_completions(filter)/*{{{*/
}), }),
command.short_help]) command.short_help])
} }
settings = get_settings_completions(filter, true); options = get_options_completions(filter, true);
help_array = help_array.concat(settings.map(function($_) { help_array = help_array.concat(options.map(function($_) {
return [ return [
$_[COMMANDS].map(function($_) { return "'" + $_ + "'"; }), $_[COMMANDS].map(function($_) { return "'" + $_ + "'"; }),
$_[1] $_[1]
@@ -298,23 +298,23 @@ function get_command_completions(filter)/*{{{*/
return build_longest_starting_substring(completions, filter); return build_longest_starting_substring(completions, filter);
}/*}}}*/ }/*}}}*/
function get_settings_completions(filter, unfiltered)/*{{{*/ function get_options_completions(filter, unfiltered)/*{{{*/
{ {
g_substrings = []; g_substrings = [];
var settings_completions = []; var options_completions = [];
var no_mode = false; var no_mode = false;
if (filter.indexOf("no") == 0) // boolean option if (filter.indexOf("no") == 0) // boolean option
{ {
no_mode = true; no_mode = true;
filter = filter.substr(2); filter = filter.substr(2);
} }
if (unfiltered) return g_settings.filter(function($_) { if (unfiltered) return g_options.filter(function($_) {
if (no_mode && $_[TYPE] != "boolean") return false; if (no_mode && $_[TYPE] != "boolean") return false;
else return true; else return true;
}).map(function($_) { }).map(function($_) {
return [$_[COMMANDS], $_[SHORTHELP]]; return [$_[COMMANDS], $_[SHORTHELP]];
}); });
if (!filter) return g_settings.filter(function($_) { if (!filter) return g_options.filter(function($_) {
if (no_mode && $_[TYPE] != "boolean") return false; if (no_mode && $_[TYPE] != "boolean") return false;
else return true; else return true;
}).map(function($_) { }).map(function($_) {
@@ -326,49 +326,49 @@ function get_settings_completions(filter, unfiltered)/*{{{*/
else if(filter.length > 0 && filter.lastIndexOf("=") == filter.length -1) else if(filter.length > 0 && filter.lastIndexOf("=") == filter.length -1)
{ {
filter = filter.substr(0, filter.length-1); filter = filter.substr(0, filter.length-1);
for(var i=0; i<g_settings.length; i++) for(var i=0; i<g_options.length; i++)
{ {
for(var j=0; j<g_settings[i][COMMANDS].length; j++) for(var j=0; j<g_options[i][COMMANDS].length; j++)
{ {
if (g_settings[i][COMMANDS][j] == filter) if (g_options[i][COMMANDS][j] == filter)
{ {
settings_completions.push([filter + "=" + g_settings[i][GETFUNC].call(this), ""]); options_completions.push([filter + "=" + g_options[i][GETFUNC].call(this), ""]);
return settings_completions; return options_completions;
} }
} }
} }
return settings_completions; return options_completions;
} }
// can't use b_l_s_s, since this has special requirements (the prefix) // can't use b_l_s_s, since this has special requirements (the prefix)
var filter_length = filter.length; var filter_length = filter.length;
for (var i = 0; i < g_settings.length; i++) for (var i = 0; i < g_options.length; i++)
{ {
if (no_mode && g_settings[i][TYPE] != "boolean") if (no_mode && g_options[i][TYPE] != "boolean")
continue; continue;
var prefix = no_mode ? 'no' : ''; var prefix = no_mode ? 'no' : '';
for (var j = 0; j < g_settings[i][COMMANDS].length; j++) for (var j = 0; j < g_options[i][COMMANDS].length; j++)
{ {
if (g_settings[i][COMMANDS][j].indexOf(filter) != 0) continue; if (g_options[i][COMMANDS][j].indexOf(filter) != 0) continue;
if (g_substrings.length == 0) if (g_substrings.length == 0)
{ {
var length = g_settings[i][COMMANDS][j].length; var length = g_options[i][COMMANDS][j].length;
for (var k = filter_length; k <= length; k++) for (var k = filter_length; k <= length; k++)
g_substrings.push(prefix + g_settings[i][COMMANDS][j].substring(0, k)); g_substrings.push(prefix + g_options[i][COMMANDS][j].substring(0, k));
} }
else else
{ {
g_substrings = g_substrings.filter(function($_) { g_substrings = g_substrings.filter(function($_) {
return g_settings[i][COMMANDS][j].indexOf($_) == 0; return g_options[i][COMMANDS][j].indexOf($_) == 0;
}); });
} }
settings_completions.push([prefix + g_settings[i][COMMANDS][j], g_settings[i][SHORTHELP]]); options_completions.push([prefix + g_options[i][COMMANDS][j], g_options[i][SHORTHELP]]);
break; break;
} }
} }
return settings_completions; return options_completions;
}/*}}}*/ }/*}}}*/
function get_buffer_completions(filter)/*{{{*/ function get_buffer_completions(filter)/*{{{*/
@@ -394,7 +394,6 @@ function get_buffer_completions(filter)/*{{{*/
if (title.indexOf(filter) == -1 && url.indexOf(filter) == -1) if (title.indexOf(filter) == -1 && url.indexOf(filter) == -1)
continue; continue;
if (title.indexOf(filter) != -1 || url.indexOf(filter) != -1) if (title.indexOf(filter) != -1 || url.indexOf(filter) != -1)
{ {
if (title == "") if (title == "")

View File

@@ -79,7 +79,7 @@ table.commands {
table.mappings { table.mappings {
background-color: rgb(230, 240, 250); background-color: rgb(230, 240, 250);
} }
table.settings { table.options {
background-color: rgb(240, 250, 230); background-color: rgb(240, 250, 230);
} }
@@ -89,7 +89,7 @@ fieldset.paypal {
.command { font-weight: bold; color: #632610; } .command { font-weight: bold; color: #632610; }
.mapping { font-weight: bold; color: #102663; } .mapping { font-weight: bold; color: #102663; }
.setting { font-weight: bold; color: #106326; } .option { font-weight: bold; color: #106326; }
.argument { color: #6A97D4; } .argument { color: #6A97D4; }
.version { .version {
position: absolute; position: absolute;

View File

@@ -41,8 +41,8 @@ function help(section, easter)
// xxx: for firebug: :js Firebug.toggleBar(true) // xxx: for firebug: :js Firebug.toggleBar(true)
/* commands = array where help information is located /* commands = array where help information is located
* beg = string which is printed before the commmand/setting/mapping name * beg = string which is printed before the commmand/option/mapping name
* end = string which is printed after the commmand/setting/mapping name * end = string which is printed after the commmand/option/mapping name
* func = called with 'command', result is a string is prepended to the help text * func = called with 'command', result is a string is prepended to the help text
*/ */
function makeHelpString(commands, beg, end, func) function makeHelpString(commands, beg, end, func)
@@ -64,8 +64,8 @@ function help(section, easter)
usage = usage.replace(/\\n/g, "<br/>"); usage = usage.replace(/\\n/g, "<br/>");
// color {count} and [url] arguments in the usage, not nice and error prone but the regexp work (for now) // color {count} and [url] arguments in the usage, not nice and error prone but the regexp work (for now)
usage = usage.replace(/(^|;|\n|\s|\]|\}|=|<br\/?>)({.*?}|\[.*?\])/gm, "$1<span class=\"argument\">$2</span>"); usage = usage.replace(/(^|;|\n|\s|\]|\}|=|<br\/?>)({.*?}|\[.*?\])/gm, "$1<span class=\"argument\">$2</span>");
// and the 'setting' in a different color // and the 'option' in a different color
usage = usage.replace(/^'(\w+)'/gm, "'<span class=\"setting\">$1</span>'"); usage = usage.replace(/^'(\w+)'/gm, "'<span class=\"option\">$1</span>'");
ret += "<code>" +beg+ usage +end+ '</code><br/>'; ret += "<code>" +beg+ usage +end+ '</code><br/>';
} }
ret += '</td><td valign="top">'; ret += '</td><td valign="top">';
@@ -76,7 +76,7 @@ function help(section, easter)
ret += '<span class="shorthelp">'; ret += '<span class="shorthelp">';
ret += commands[i][SHORTHELP]; // the help description ret += commands[i][SHORTHELP]; // the help description
ret += "</span><br/>"; ret += "</span><br/>";
if(func) // for settings whe print default values here, e.g. if(func) // for options we print default values here, e.g.
{ {
ret += func.call(this, commands[i]); ret += func.call(this, commands[i]);
ret += "<br/>"; ret += "<br/>";
@@ -110,7 +110,7 @@ function help(section, easter)
} }
return ret; return ret;
} }
function makeSettingsHelpString(command) function makeOptionsHelpString(command)
{ {
var ret = ""; var ret = "";
ret = command[TYPE] + ' (default: <span style="font-family: monospace;">'; ret = command[TYPE] + ' (default: <span style="font-family: monospace;">';
@@ -186,10 +186,10 @@ function help(section, easter)
'now dead, unfortunately. So now you might wonder what the meaning of death<br/>' + 'now dead, unfortunately. So now you might wonder what the meaning of death<br/>' +
'is...</p>\n'; 'is...</p>\n';
var settings = '<div><h2 id="settings">Settings</h2></div>\n' + var options = '<div><h2 id="options">Options</h2></div>\n' +
'<table class="vimperator settings">\n'; '<table class="vimperator options">\n';
settings += makeHelpString(g_settings, "'", "'", makeSettingsHelpString); options += makeHelpString(g_options, "'", "'", makeOptionsHelpString);
settings += '</table>'; options += '</table>';
var fulldoc = '<?xml version="1.0"?>\n' + var fulldoc = '<?xml version="1.0"?>\n' +
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' +
@@ -202,7 +202,7 @@ function help(section, easter)
introduction + introduction +
mappings + mappings +
commands + commands +
settings + options +
'\n</div>\n</body>\n</html>'; '\n</div>\n</body>\n</html>';
var doc = window.content.document; var doc = window.content.document;

View File

@@ -236,7 +236,7 @@ function Mappings()//{{{
addDefaultMap(new Map(vimperator.modes.NORMAL, ["gP"], function(count) { openURLsInNewTab(readFromClipboard(), false); }, addDefaultMap(new Map(vimperator.modes.NORMAL, ["gP"], function(count) { openURLsInNewTab(readFromClipboard(), false); },
{ {
short_help: "Open (put) an URL based on the current clipboard contents in a new buffer", short_help: "Open (put) an URL based on the current clipboard contents in a new buffer",
help: "Works like <code class=\"mapping\">P</code>, but inverts the <code class=\"setting\">'activate'</code> setting." help: "Works like <code class=\"mapping\">P</code>, but inverts the <code class=\"option\">'activate'</code> option."
} }
)); ));
addDefaultMap(new Map(vimperator.modes.NORMAL, ["gt", "<C-n>", "<C-Tab>"], function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); }, addDefaultMap(new Map(vimperator.modes.NORMAL, ["gt", "<C-n>", "<C-Tab>"], function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); },
@@ -276,14 +276,14 @@ function Mappings()//{{{
addDefaultMap(new Map(vimperator.modes.NORMAL, ["p", "<MiddleMouse>"], function(count) { openURLs(readFromClipboard()); }, addDefaultMap(new Map(vimperator.modes.NORMAL, ["p", "<MiddleMouse>"], function(count) { openURLs(readFromClipboard()); },
{ {
short_help: "Open (put) an URL based on the current clipboard contents in the current buffer", short_help: "Open (put) an URL based on the current clipboard contents in the current buffer",
help: "You can also just select some non-URL text, and search for it with the default search engine or keyword (specified by the <code class=\"setting\">'defsearch'</code> setting) with <code class=\"mapping\">p</code>." help: "You can also just select some non-URL text, and search for it with the default search engine or keyword (specified by the <code class=\"option\">'defsearch'</code> option) with <code class=\"mapping\">p</code>."
} }
)); ));
addDefaultMap(new Map(vimperator.modes.NORMAL, ["P"], function(count) { openURLsInNewTab(readFromClipboard(), true); }, addDefaultMap(new Map(vimperator.modes.NORMAL, ["P"], function(count) { openURLsInNewTab(readFromClipboard(), true); },
{ {
short_help: "Open (put) an URL based on the current clipboard contents in a new buffer", short_help: "Open (put) an URL based on the current clipboard contents in a new buffer",
help: "Works like <code class=\"mapping\">p</code>, but opens a new tab.<br/>" + help: "Works like <code class=\"mapping\">p</code>, but opens a new tab.<br/>" +
"Whether the new buffer is activated, depends on the <code class=\"setting\">'activate'</code> setting." "Whether the new buffer is activated, depends on the <code class=\"option\">'activate'</code> option."
} }
)); ));
addDefaultMap(new Map(vimperator.modes.NORMAL, ["r"], function(count) { reload(getBrowser().mCurrentTab, false); }, addDefaultMap(new Map(vimperator.modes.NORMAL, ["r"], function(count) { reload(getBrowser().mCurrentTab, false); },
@@ -406,7 +406,7 @@ function Mappings()//{{{
{ {
short_help: "Scroll document to the left", short_help: "Scroll document to the left",
help: "Count is supported: <code class=\"mapping\">10h</code> will move 10 times as much to the left.<br/>" + help: "Count is supported: <code class=\"mapping\">10h</code> will move 10 times as much to the left.<br/>" +
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).", "If the document cannot scroll more, a beep is emmited (unless <code class=\"option\">'beep'</code> is turned off).",
flags: Mappings.flags.COUNT flags: Mappings.flags.COUNT
} }
)); ));
@@ -414,7 +414,7 @@ function Mappings()//{{{
{ {
short_help: "Scroll document down", short_help: "Scroll document down",
help: "Count is supported: <code class=\"mapping\">10j</code> will move 10 times as much down.<br/>" + help: "Count is supported: <code class=\"mapping\">10j</code> will move 10 times as much down.<br/>" +
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).", "If the document cannot scroll more, a beep is emmited (unless <code class=\"option\">'beep'</code> is turned off).",
flags: Mappings.flags.COUNT flags: Mappings.flags.COUNT
} }
)); ));
@@ -422,7 +422,7 @@ function Mappings()//{{{
{ {
short_help: "Scroll document up", short_help: "Scroll document up",
help: "Count is supported: <code class=\"mapping\">10k</code> will move 10 times as much up.<br/>" + help: "Count is supported: <code class=\"mapping\">10k</code> will move 10 times as much up.<br/>" +
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).", "If the document cannot scroll more, a beep is emmited (unless <code class=\"option\">'beep'</code> is turned off).",
flags: Mappings.flags.COUNT flags: Mappings.flags.COUNT
} }
)); ));
@@ -430,7 +430,7 @@ function Mappings()//{{{
{ {
short_help: "Scroll document to the right", short_help: "Scroll document to the right",
help: "Count is supported: <code class=\"mapping\">10l</code> will move 10 times as much to the right.<br/>" + help: "Count is supported: <code class=\"mapping\">10l</code> will move 10 times as much to the right.<br/>" +
"If the document cannot scroll more, a beep is emmited (unless <code class=\"setting\">'beep'</code> is turned off).", "If the document cannot scroll more, a beep is emmited (unless <code class=\"option\">'beep'</code> is turned off).",
flags: Mappings.flags.COUNT flags: Mappings.flags.COUNT
} }
)); ));
@@ -495,7 +495,7 @@ function Mappings()//{{{
addDefaultMap(new Map(vimperator.modes.NORMAL, ["f"], function(count) { hah.enableHahMode(vimperator.modes.QUICK_HINT); }, addDefaultMap(new Map(vimperator.modes.NORMAL, ["f"], function(count) { hah.enableHahMode(vimperator.modes.QUICK_HINT); },
{ {
short_help: "Start QuickHint mode", short_help: "Start QuickHint mode",
help: "In QuickHint mode, every hintable item (according to the <code class=\"setting\">'hinttags'</code> XPath query) is assigned a label.<br/>" + help: "In QuickHint mode, every hintable item (according to the <code class=\"option\">'hinttags'</code> XPath query) is assigned a label.<br/>" +
"If you then press the keys for a label, it is followed as soon as it can be uniquely identified and this mode is stopped. Or press <code class=\"mapping\">&lt;Esc&gt;</code> to stop this mode.<br/>" + "If you then press the keys for a label, it is followed as soon as it can be uniquely identified and this mode is stopped. Or press <code class=\"mapping\">&lt;Esc&gt;</code> to stop this mode.<br/>" +
"If you write the hint in ALLCAPS, the hint is followed in a background tab." "If you write the hint in ALLCAPS, the hint is followed in a background tab."
} }
@@ -503,7 +503,7 @@ function Mappings()//{{{
addDefaultMap(new Map(vimperator.modes.NORMAL, ["F"], function(count) { hah.enableHahMode(vimperator.modes.ALWAYS_HINT); }, addDefaultMap(new Map(vimperator.modes.NORMAL, ["F"], function(count) { hah.enableHahMode(vimperator.modes.ALWAYS_HINT); },
{ {
short_help: "Start AlwaysHint mode", short_help: "Start AlwaysHint mode",
help: "In AlwaysHint mode, every hintable item (according to the <code class=\"setting\">'hinttags'</code> XPath query) is assigned a label.<br/>" + help: "In AlwaysHint mode, every hintable item (according to the <code class=\"option\">'hinttags'</code> XPath query) is assigned a label.<br/>" +
"If you then press the keys for a label, it is followed as soon as it can be uniquely identified. Labels stay active after following a hint in this mode, press <code class=\"mapping\">&lt;Esc&gt;</code> to stop this mode.<br/>" + "If you then press the keys for a label, it is followed as soon as it can be uniquely identified. Labels stay active after following a hint in this mode, press <code class=\"mapping\">&lt;Esc&gt;</code> to stop this mode.<br/>" +
"This hint mode is especially useful for browsing large sites like Forums as hints are automatically regenerated when switching to a new document.<br/>" + "This hint mode is especially useful for browsing large sites like Forums as hints are automatically regenerated when switching to a new document.<br/>" +
"Also, most <code class=\"mapping\">Ctrl</code>-prefixed short_helpcut keys are available in this mode for navigation." "Also, most <code class=\"mapping\">Ctrl</code>-prefixed short_helpcut keys are available in this mode for navigation."
@@ -527,7 +527,7 @@ function Mappings()//{{{
"<li><code class=\"mapping\">&lt;C-w&gt;</code> to open its destination in a new window</li>" + "<li><code class=\"mapping\">&lt;C-w&gt;</code> to open its destination in a new window</li>" +
"</ul>" + "</ul>" +
"Multiple hints can be seperated by commas where it makes sense. <code class=\"mapping\">;ab,ac,adt</code> opens <code>AB</code>, <code>AC</code> and <code>AD</code> in a new tab.<br/>" + "Multiple hints can be seperated by commas where it makes sense. <code class=\"mapping\">;ab,ac,adt</code> opens <code>AB</code>, <code>AC</code> and <code>AD</code> in a new tab.<br/>" +
"Hintable elements for this mode can be set in the <code class=\"setting\">'extendedhinttags'</code> XPath string." "Hintable elements for this mode can be set in the <code class=\"option\">'extendedhinttags'</code> XPath string."
} }
)); ));

View File

@@ -1,4 +1,4 @@
// settings.js // options.js
// //
// handles all persistent storage of information // handles all persistent storage of information
// to and from the firefox registry // to and from the firefox registry
@@ -10,7 +10,7 @@ const DEFAULT = 8;
const CHECKFUNC = 9; const CHECKFUNC = 9;
// the global handle to the root of the firefox settings // the global handle to the root of the firefox options
var g_firefox_prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); var g_firefox_prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var g_vimperator_prefs = null; var g_vimperator_prefs = null;
@@ -18,10 +18,10 @@ var g_vimperator_prefs = null;
var opt_usermode = false; var opt_usermode = false;
var opt_fullscreen = false; var opt_fullscreen = false;
/* all user-setable vimperator settings /* all user-setable vimperator options
* format: * format:
* [ * [
* 0: [all names of this setting], * 0: [all names of this option],
* 1: usage, * 1: usage,
* 2: shorthelp * 2: shorthelp
* 3: help text, * 3: help text,
@@ -33,7 +33,7 @@ var opt_fullscreen = false;
* 9: checkfunc, * 9: checkfunc,
* ] * ]
*/ */
var g_settings = [/*{{{*/ var g_options = [/*{{{*/
[ [
["activate"], ["activate"],
["activate"], ["activate"],
@@ -68,7 +68,7 @@ var g_settings = [/*{{{*/
"<li><b>b</b>: Bookmarks</li>" + "<li><b>b</b>: Bookmarks</li>" +
"<li><b>h</b>: History</li></ul>" + "<li><b>h</b>: History</li></ul>" +
"The order is important, so <code class=\"command\">:set complete=bs</code> would list bookmarks first, and then any available quick searches.<br/>"+ "The order is important, so <code class=\"command\">:set complete=bs</code> would list bookmarks first, and then any available quick searches.<br/>"+
"Add 'sort' to the <code class=\"setting\">'wildoptions'</code> setting if you want all entries sorted.", "Add 'sort' to the <code class=\"option\">'wildoptions'</code> option if you want all entries sorted.",
"charlist", "charlist",
null, null,
function(value) { set_pref("complete", value); }, function(value) { set_pref("complete", value); },
@@ -279,7 +279,7 @@ var g_settings = [/*{{{*/
["usermode", "um", "nousermode", "noum"], ["usermode", "um", "nousermode", "noum"],
["usermode", "um"], ["usermode", "um"],
"Show current website with a minimal stylesheet to make it easily accessible", "Show current website with a minimal stylesheet to make it easily accessible",
"Note that this is a local setting for now, later it may be split into a global and <code class=\"command\">:setlocal</code> part", "Note that this is a local option for now, later it may be split into a global and <code class=\"command\">:setlocal</code> part",
"boolean", "boolean",
null, null,
function(value) { opt_usermode = value; setStyleDisabled(value); }, function(value) { opt_usermode = value; setStyleDisabled(value); },
@@ -319,7 +319,7 @@ var g_settings = [/*{{{*/
"A list of words that change how command line completion is done.<br/>"+ "A list of words that change how command line completion is done.<br/>"+
"Currently only one word is allowed:<br/>"+ "Currently only one word is allowed:<br/>"+
"<table>"+ "<table>"+
"<tr><td><b>sort</b></td><td>Always sorts completion list, overriding the <code class=\"setting\">'complete'</code> option.</td></tr>" + "<tr><td><b>sort</b></td><td>Always sorts completion list, overriding the <code class=\"option\">'complete'</code> option.</td></tr>" +
"</table>", "</table>",
"stringlist", "stringlist",
null, null,
@@ -353,17 +353,17 @@ var g_settings = [/*{{{*/
]/*}}}*/ ]/*}}}*/
// return null, if the cmd cannot be found in our g_settings array, or // return null, if the cmd cannot be found in our g_options array, or
// otherwise a refernce to our command // otherwise a refernce to our command
function get_setting(cmd)/*{{{*/ function get_option(cmd)/*{{{*/
{ {
for (var i=0; i < g_settings.length; i++) for (var i=0; i < g_options.length; i++)
{ {
for (var j=0; j < g_settings[i][COMMANDS].length; j++) for (var j=0; j < g_options[i][COMMANDS].length; j++)
{ {
if (g_settings[i][COMMANDS][j] == cmd) if (g_options[i][COMMANDS][j] == cmd)
{ {
return g_settings[i]; return g_options[i];
} }
} }
} }
@@ -401,11 +401,11 @@ function get_pref(name, forced_default)
default_value = forced_default; default_value = forced_default;
else else
{ {
for (var i=0; i<g_settings.length; i++) for (var i=0; i<g_options.length; i++)
{ {
if (g_settings[i][COMMANDS][0] == name) // only first name is searched if (g_options[i][COMMANDS][0] == name) // only first name is searched
{ {
default_value = g_settings[i][DEFAULT]; default_value = g_options[i][DEFAULT];
break; break;
} }
} }

View File

@@ -42,7 +42,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
<script type="application/x-javascript;version=1.7" src="vimperator.js"/> <script type="application/x-javascript;version=1.7" src="vimperator.js"/>
<script type="application/x-javascript;version=1.7" src="commands.js"/> <script type="application/x-javascript;version=1.7" src="commands.js"/>
<script type="application/x-javascript;version=1.7" src="ui.js"/> <script type="application/x-javascript;version=1.7" src="ui.js"/>
<script type="application/x-javascript;version=1.7" src="settings.js"/> <script type="application/x-javascript;version=1.7" src="options.js"/>
<script type="application/x-javascript;version=1.7" src="completion.js"/> <script type="application/x-javascript;version=1.7" src="completion.js"/>
<script type="application/x-javascript;version=1.7" src="bookmarks.js"/> <script type="application/x-javascript;version=1.7" src="bookmarks.js"/>
<script type="application/x-javascript;version=1.7" src="hints.js"/> <script type="application/x-javascript;version=1.7" src="hints.js"/>