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:
2
Donators
2
Donators
@@ -2,8 +2,8 @@
|
|||||||
<b>Note:</b> If you don't wish to appear on this list when making a donation, please tell me.
|
<b>Note:</b> If you don't wish to appear on this list when making a donation, please tell me.
|
||||||
|
|
||||||
2008:
|
2008:
|
||||||
* Kurtis Rader
|
|
||||||
* Andrew Pantyukhin
|
* Andrew Pantyukhin
|
||||||
|
* Kurtis Rader
|
||||||
|
|
||||||
2007:
|
2007:
|
||||||
* Richard Terrell
|
* Richard Terrell
|
||||||
|
|||||||
@@ -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> " +
|
"<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/>" +
|
"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&</code> resets all options to their default values.<br/>",
|
"<code class=\"command\">:set all</code> shows the current value of all options and <code class=\"command\">:set all&</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?
|
// TODO: sclose instead?
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ vimperator.Completion = function () //{{{
|
|||||||
substrings = [];
|
substrings = [];
|
||||||
for (var command in vimperator.commands)
|
for (var command in vimperator.commands)
|
||||||
helpArray.push([command.longNames.map(function ($_) { return ":" + $_; }), command.shortHelp]);
|
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 ($_) {
|
helpArray = helpArray.concat(options.map(function ($_) {
|
||||||
return [
|
return [
|
||||||
$_[0].map(function ($_) { return "'" + $_ + "'"; }),
|
$_[0].map(function ($_) { return "'" + $_ + "'"; }),
|
||||||
@@ -346,7 +346,7 @@ vimperator.Completion = function () //{{{
|
|||||||
return [0, buildLongestStartingSubstring(completions, filter)];
|
return [0, buildLongestStartingSubstring(completions, filter)];
|
||||||
},
|
},
|
||||||
|
|
||||||
option: function (filter, unfiltered)
|
option: function (filter, special, unfiltered)
|
||||||
{
|
{
|
||||||
substrings = [];
|
substrings = [];
|
||||||
var optionCompletions = [];
|
var optionCompletions = [];
|
||||||
@@ -369,6 +369,9 @@ vimperator.Completion = function () //{{{
|
|||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (special)
|
||||||
|
alert(":set! completion will complete about:config options");
|
||||||
|
|
||||||
if (!filter)
|
if (!filter)
|
||||||
{
|
{
|
||||||
var options = [];
|
var options = [];
|
||||||
@@ -698,7 +701,7 @@ vimperator.Completion = function () //{{{
|
|||||||
{
|
{
|
||||||
matches = str.match(/^:*\d*\w+!?\s+/);
|
matches = str.match(/^:*\d*\w+!?\s+/);
|
||||||
exLength = matches ? matches[0].length : 0;
|
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];
|
return [exLength + start, completions];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user