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

added framework for :foo! <tab> special completion

This commit is contained in:
Martin Stubenschrott
2008-01-07 16:23:26 +00:00
parent a43249672f
commit 52df3a24dc
3 changed files with 8 additions and 5 deletions

View File

@@ -2,8 +2,8 @@
<b>Note:</b> If you don't wish to appear on this list when making a donation, please tell me.
2008:
* Kurtis Rader
* Andrew Pantyukhin
* Kurtis Rader
2007:
* Richard Terrell

View File

@@ -2115,7 +2115,7 @@ vimperator.Commands = function () //{{{
"<code class=\"command\">:set option+={value}</code>, <code class=\"command\">:set option^={value}</code> and <code class=\"command\">:set option-={value}</code> " +
"adds/multiplies/subtracts <code class=\"argument\">{value}</code> from a number option and appends/prepends/removes <code class=\"argument\">{value}</code> from a string option.<br/>" +
"<code class=\"command\">:set all</code> shows the current value of all options and <code class=\"command\">:set all&amp;</code> resets all options to their default values.<br/>",
completer: function (filter) { return vimperator.completion.option(filter); }
completer: function (filter, special) { return vimperator.completion.option(filter, special); }
}
));
// TODO: sclose instead?

View File

@@ -279,7 +279,7 @@ vimperator.Completion = function () //{{{
substrings = [];
for (var command in vimperator.commands)
helpArray.push([command.longNames.map(function ($_) { return ":" + $_; }), command.shortHelp]);
options = this.option(filter, true);
options = this.option(filter, false, true);
helpArray = helpArray.concat(options.map(function ($_) {
return [
$_[0].map(function ($_) { return "'" + $_ + "'"; }),
@@ -346,7 +346,7 @@ vimperator.Completion = function () //{{{
return [0, buildLongestStartingSubstring(completions, filter)];
},
option: function (filter, unfiltered)
option: function (filter, special, unfiltered)
{
substrings = [];
var optionCompletions = [];
@@ -369,6 +369,9 @@ vimperator.Completion = function () //{{{
return options;
}
if (special)
alert(":set! completion will complete about:config options");
if (!filter)
{
var options = [];
@@ -698,7 +701,7 @@ vimperator.Completion = function () //{{{
{
matches = str.match(/^:*\d*\w+!?\s+/);
exLength = matches ? matches[0].length : 0;
[start, completions] = command.completer.call(this, args);
[start, completions] = command.completer.call(this, args, special);
}
return [exLength + start, completions];
}