mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 10:37:59 +01:00
add some more completion args for :command -complete
This commit is contained in:
@@ -512,7 +512,7 @@ function Buffer() //{{{
|
||||
|
||||
stylesheetSwitchAll(window.content, args);
|
||||
},
|
||||
{ completer: function (filter) completion.stylesheet(filter) });
|
||||
{ completer: function (filter) completion.alternateStylesheet(filter) });
|
||||
|
||||
commands.add(["re[load]"],
|
||||
"Reload current page",
|
||||
|
||||
@@ -668,10 +668,18 @@ function Commands() //{{{
|
||||
liberator.execute(commands.replaceTokens(this.replacementText, tokens));
|
||||
}
|
||||
|
||||
// TODO: add dir, highlight, menu, option completers
|
||||
var completeOptionMap = { url: "url", buffer: "buffer", bookmark: "bookmark", command: "ex",
|
||||
environment: "environment", event: "autocmdEvent", file: "file", shellcmd: "shellCommand",
|
||||
javascript: "javascript", help: "help", mapping: "userMapping" };
|
||||
// TODO: offer completion.ex?
|
||||
var completeOptionMap = {
|
||||
altstyle: "alternateStylesheet", bookmark: "bookmark",
|
||||
buffer: "buffer", color: "colorScheme", command: "command",
|
||||
dialog: "dialog", dir: "directory", environment: "environment",
|
||||
event: "autocmdEvent", file: "file", help: "help",
|
||||
highlight: "highlightGroup", javascript: "javascript", macro: "macro",
|
||||
mapping: "userMapping", menu: "menuItem", option: "option",
|
||||
preference: "preference", search: "search",
|
||||
shellcmd: "shellCommand", sidebar: "sidebar", url: "url",
|
||||
usercommand: "userCommand"
|
||||
};
|
||||
|
||||
// TODO: Vim allows commands to be defined without {rep} if there are {attr}s
|
||||
// specified - useful?
|
||||
|
||||
@@ -795,6 +795,8 @@ function Completion() //{{{
|
||||
////////////////////// COMPLETION TYPES ////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
autocmdEvent: function autocmdEvent(filter) [0, this.filter(config.autocommands, filter)],
|
||||
|
||||
bookmark: function (filter)
|
||||
{
|
||||
return {
|
||||
@@ -908,6 +910,8 @@ function Completion() //{{{
|
||||
|
||||
dialog: function dialog(filter) [0, this.filter(config.dialogs, filter)],
|
||||
|
||||
directory: function (filter, tail) [0, this.file(filter, tail)[1].filter(function (f) f[1] == "Directory")],
|
||||
|
||||
environment: function environment(filter)
|
||||
{
|
||||
let command = liberator.has("Win32") ? "set" : "export";
|
||||
@@ -923,8 +927,6 @@ function Completion() //{{{
|
||||
return [0, this.filter(vars, filter)];
|
||||
},
|
||||
|
||||
autocmdEvent: function autocmdEvent(filter) [0, this.filter(config.autocommands, filter)],
|
||||
|
||||
// provides completions for ex commands, including their arguments
|
||||
ex: function ex(str)
|
||||
{
|
||||
@@ -1028,6 +1030,8 @@ function Completion() //{{{
|
||||
return [0, this.filter(res, filter)];
|
||||
},
|
||||
|
||||
highlightGroup: function highlightGroup(filter) commands.get("highlight").completer(filter), // XXX
|
||||
|
||||
history: function _history(filter) [0, history.get(filter)],
|
||||
|
||||
get javascriptCompleter() javascript,
|
||||
@@ -1044,6 +1048,12 @@ function Completion() //{{{
|
||||
return [0, this.filter(macros, filter)];
|
||||
},
|
||||
|
||||
menuItem: function menuItem(filter) commands.get("emenu").completer(filter), // XXX
|
||||
|
||||
option: function option(filter) commands.get("set").completer(filter), // XXX
|
||||
|
||||
preference: function preference(filter) commands.get("set").completer(filter, true), // XXX
|
||||
|
||||
search: function search(filter)
|
||||
{
|
||||
let [, keyword, args] = filter.match(/^\s*(\S*)\s*(.*)/);
|
||||
@@ -1163,9 +1173,9 @@ function Completion() //{{{
|
||||
return [0, this.filter(panels, filter)];
|
||||
},
|
||||
|
||||
stylesheet: function stylesheet(filter)
|
||||
alternateStylesheet: function alternateStylesheet(filter)
|
||||
{
|
||||
var completions = buffer.alternateStyleSheets.map(
|
||||
let completions = buffer.alternateStyleSheets.map(
|
||||
function (stylesheet) [stylesheet.title, stylesheet.href || "inline"]
|
||||
);
|
||||
|
||||
|
||||
@@ -293,17 +293,29 @@ Completion for arguments to user defined commands is not available by default.
|
||||
Completion can be enabled by specifying one of the following arguments to the
|
||||
-complete option when defining the command.
|
||||
`----------------`--------------------------------------------------------------
|
||||
*altstyle* alternate author style sheets
|
||||
*bookmark* bookmarks
|
||||
*buffer* buffers
|
||||
*color* color schemes
|
||||
*command* Ex commands
|
||||
*dialog* Firefox dialogs
|
||||
*dir* directories
|
||||
*environment* environment variables
|
||||
*event* autocommand events
|
||||
*file* files
|
||||
*help* help tags
|
||||
*highlight* highlight groups
|
||||
*javascript* JavaScript expressions
|
||||
*macro* named macros
|
||||
*mapping* user mappings
|
||||
*menu* menu items
|
||||
*option* Vimperator options
|
||||
*preference* Firefox preferences
|
||||
*search* search engines and keywords
|
||||
*shellcmd* shell commands
|
||||
*sidebar* sidebar panels
|
||||
*url* URLs
|
||||
*usercommand* user commands
|
||||
*custom,{func}* custom completion, provided by {func}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user