mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-30 13:25:45 +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"]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user