diff --git a/content/addressbook.js b/content/addressbook.js index 418c241f..cc8ba2a9 100644 --- a/content/addressbook.js +++ b/content/addressbook.js @@ -126,15 +126,16 @@ liberator.Addressbook = function () //{{{ }, { + argCount: "+", options: [[["-firstname", "-f"], liberator.commands.OPTION_STRING], [["-lastname", "-l"], liberator.commands.OPTION_STRING], - [["-name", "-n"], liberator.commands.OPTION_STRING]], - argCount: "+" + [["-name", "-n"], liberator.commands.OPTION_STRING]] }); liberator.commands.add(["contacts", "addr[essbook]"], "List or open multiple addresses", - function (args, special) { liberator.addressbook.list(args, special); }); + function (args, special) liberator.addressbook.list(args, special), + { bangAllowed: true }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// diff --git a/content/bookmarks.js b/content/bookmarks.js index 88dba54e..a5830ad1 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -261,10 +261,10 @@ liberator.Bookmarks = function () //{{{ liberator.echoerr("Exxx: Could not add bookmark `" + title + "'", liberator.commandline.FORCE_SINGLELINE); }, { + argCount: "?", options: [[["-title", "-t"], liberator.commands.OPTION_STRING], [["-tags", "-T"], liberator.commands.OPTION_LIST], - [["-keyword", "-k"], liberator.commands.OPTION_STRING, function (arg) { return /\w/.test(arg); }]], - argCount: "?" + [["-keyword", "-k"], liberator.commands.OPTION_STRING, function (arg) { return /\w/.test(arg); }]] }); liberator.commands.add(["bmarks"], @@ -274,13 +274,14 @@ liberator.Bookmarks = function () //{{{ liberator.bookmarks.list(args.arguments.join(" "), args["-tags"] || [], special); }, { + bangAllowed: true, completer: function (filter) [0, liberator.bookmarks.get(filter)], options: [[["-tags", "-T"], liberator.commands.OPTION_LIST]] }); liberator.commands.add(["delbm[arks]"], "Delete a bookmark", - function (args, special) + function (args) { var url = args; if (!url) @@ -289,9 +290,7 @@ liberator.Bookmarks = function () //{{{ var deletedCount = liberator.bookmarks.remove(url); liberator.echo(deletedCount + " bookmark(s) with url `" + url + "' deleted", liberator.commandline.FORCE_SINGLELINE); }, - { - completer: function (filter) [0, liberator.bookmarks.get(filter)] - }); + { completer: function (filter) [0, liberator.bookmarks.get(filter)] }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// @@ -602,6 +601,7 @@ liberator.History = function () //{{{ } }, { + bangAllowed: true, completer: function (filter) { var sh = getWebNavigation().sessionHistory; @@ -648,6 +648,7 @@ liberator.History = function () //{{{ } }, { + bangAllowed: true, completer: function (filter) { var sh = getWebNavigation().sessionHistory; @@ -666,8 +667,9 @@ liberator.History = function () //{{{ liberator.commands.add(["hist[ory]", "hs"], "Show recently visited URLs", - function (args, special) { liberator.history.list(args, special); }, + function (args, special) liberator.history.list(args, special), { + bangAllowed: true, completer: function (filter) [0, liberator.history.get(filter)] }); @@ -849,7 +851,8 @@ liberator.QuickMarks = function () //{{{ liberator.quickmarks.removeAll(); else liberator.quickmarks.remove(args); - }); + }, + { bangAllowed: true }); liberator.commands.add(["qma[rk]"], "Mark a URL with a letter for quick access", diff --git a/content/buffer.js b/content/buffer.js index f220035e..0aee1459 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -289,16 +289,12 @@ liberator.Buffer = function () //{{{ "stringlist", "\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$"); liberator.options.add(["pageinfo", "pa"], "Desired info on :pa[geinfo]", "charlist", "gfm", - { - completer: function (filter) [0, [[k, v[1]] for ([k, v] in Iterator(pageInfo))]] - }); + { completer: function (filter) [0, [[k, v[1]] for ([k, v] in Iterator(pageInfo))]] }); liberator.options.add(["scroll", "scr"], "Number of lines to scroll with and commands", "number", 0, - { - validator: function (value) value >= 0 - }); + { validator: function (value) value >= 0 }); liberator.options.add(["showstatuslinks", "ssli"], "Show the destination of the link under the cursor in the status bar", @@ -607,14 +603,12 @@ liberator.Buffer = function () //{{{ liberator.options.setPref("print.always_print_silent", aps); liberator.options.setPref("print.show_print_progress", spp); liberator.echo("Print job sent."); - }); + }, + { bangAllowed: true }); liberator.commands.add(["pa[geinfo]"], "Show various page information", - function () - { - liberator.buffer.showPageInfo(true); - }, + function () liberator.buffer.showPageInfo(true), { argCount: "0" }); liberator.commands.add(["pagest[yle]"], @@ -634,17 +628,15 @@ liberator.Buffer = function () //{{{ stylesheetSwitchAll(window.content, args); }, - { - completer: function (filter) liberator.completion.stylesheet(filter) - }); + { completer: function (filter) liberator.completion.stylesheet(filter) }); liberator.commands.add(["re[load]"], "Reload current page", - function (args, special) + function (args, special) liberator.tabs.reload(getBrowser().mCurrentTab, special), { - liberator.tabs.reload(getBrowser().mCurrentTab, special); - }, - { argCount: "0" }); + bangAllowed: true, + argCount: "0" + }); liberator.commands.add(["sav[eas]", "w[rite]"], "Save current document to disk", @@ -660,19 +652,17 @@ liberator.Buffer = function () //{{{ //} //else saveDocument(window.content.document, special); - }); + }, + { bangAllowed: true, }); liberator.commands.add(["st[op]"], "Stop loading", - function () - { - BrowserStop(); - }, + function () BrowserStop(), { argCount: "0" }); liberator.commands.add(["sty[le]"], "Add or list user styles", - function (args, special) + function (args) { let [, filter, css] = args.match(/(\S+)\s*((?:.|\n)*)/) || []; if (!css) @@ -702,7 +692,7 @@ liberator.Buffer = function () //{{{ liberator.commands.add(["dels[tyle]"], "Remove a user stylesheet", - function (args, special) styles.removeSheet(parseInt(args.arguments[0])), + function (args) styles.removeSheet(parseInt(args.arguments[0])), { completer: function (filter) [0, [[i, s[0] + ": " + s[1].replace("\n", "\\n")] for ([i, s] in styles)]], argCount: 1 @@ -710,7 +700,8 @@ liberator.Buffer = function () //{{{ liberator.commands.add(["vie[wsource]"], "View source code of current document", - function (args, special) { liberator.buffer.viewSource(args, special); }); + function (args, special) liberator.buffer.viewSource(args, special), + { bangAllowed: true }); liberator.commands.add(["zo[om]"], "Set zoom value of current web page", @@ -749,7 +740,8 @@ liberator.Buffer = function () //{{{ liberator.buffer.fullZoom = level; else liberator.buffer.textZoom = level; - }); + }, + { bangAllowed: true }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PAGE INFO /////////////////////////////////////////////// @@ -1663,7 +1655,8 @@ liberator.Marks = function () //{{{ } liberator.marks.remove(args, special); - }); + }, + { bangAllowed: true }); liberator.commands.add(["ma[rk]"], "Mark current location within the web page", diff --git a/content/commands.js b/content/commands.js index 9e330494..e985f15d 100644 --- a/content/commands.js +++ b/content/commands.js @@ -74,10 +74,11 @@ liberator.Command = function (specs, description, action, extraInfo) //{{{ this.names = expandedSpecs.names; // return all command name aliases this.description = description || ""; this.action = action; - this.completer = extraInfo.completer || null; - this.options = extraInfo.options || []; this.argCount = extraInfo.argCount || ""; + this.completer = extraInfo.completer || null; this.hereDoc = extraInfo.hereDoc || false; + this.options = extraInfo.options || []; + this.bangAllowed = extraInfo.bangAllowed || false; this.isUserCommand = extraInfo.isUserCommand || false; this.replacementText = extraInfo.replacementText || null; @@ -699,7 +700,12 @@ liberator.Commands = function () //{{{ liberator.execute(replaced); }, - { replacementText: rep }, special)) + { + bangAllowed: true, // FIXME: until we implement -bang + replacementText: rep + }, + special) + ) { liberator.echoerr("E174: Command already exists: add ! to replace it"); } @@ -723,10 +729,11 @@ liberator.Commands = function () //{{{ } }, { + bangAllowed: true, + completer: function (filter) liberator.completion.userCommand(filter) /*options: [[["-nargs"], OPTION_STRING, function (arg) { return /^(0|1|\*|\?|\+)$/.test(arg); }], [["-bang"], OPTION_NOARG], [["-bar"], OPTION_NOARG]] */ - completer: function (filter) liberator.completion.userCommand(filter) }); commandManager.add(["comc[lear]"], diff --git a/content/editor.js b/content/editor.js index 7c7a693b..964c5260 100644 --- a/content/editor.js +++ b/content/editor.js @@ -174,14 +174,11 @@ liberator.Editor = function () //{{{ liberator.commands.add([ch ? ch + "una[bbrev]" : "una[bbreviate]"], "Remove an abbreviation" + modeDescription, - function (args) { liberator.editor.removeAbbreviation(mode, args); }); + function (args) liberator.editor.removeAbbreviation(mode, args)); liberator.commands.add([ch + "abc[lear]"], "Remove all abbreviations" + modeDescription, - function () - { - liberator.editor.removeAllAbbreviations(mode); - }, + function () liberator.editor.removeAllAbbreviations(mode), { argCount: "0" }); } diff --git a/content/events.js b/content/events.js index e1232fc8..0757e219 100644 --- a/content/events.js +++ b/content/events.js @@ -112,6 +112,7 @@ liberator.AutoCommands = function () //{{{ } }, { + bangAllowed: true, completer: function (filter) { return [0, liberator.completion.filter(liberator.config.autocommands || [], filter)]; @@ -658,9 +659,7 @@ liberator.Events = function () //{{{ else liberator.events.deleteMacros(args); }, - { - completer: function (filter) liberator.completion.macro(filter) - }); + { completer: function (filter) liberator.completion.macro(filter) }); liberator.commands.add(["macros"], "List all macros", @@ -670,9 +669,7 @@ liberator.Events = function () //{{{ var str = liberator.template.tabular(["Macro", "Keys"], [], liberator.events.getMacros(args)); liberator.echo(str, liberator.commandline.FORCE_MULTILINE); }, - { - completer: function (filter) liberator.completion.macro(filter) - }); + { completer: function (filter) liberator.completion.macro(filter) }); liberator.commands.add(["pl[ay]"], "Replay a recorded macro", @@ -683,9 +680,7 @@ liberator.Events = function () //{{{ else liberator.events.playMacro(args); }, - { - completer: function (filter) liberator.completion.macro(filter) - }); + { completer: function (filter) liberator.completion.macro(filter) }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// diff --git a/content/find.js b/content/find.js index e01146b0..f581a260 100644 --- a/content/find.js +++ b/content/find.js @@ -305,10 +305,7 @@ liberator.Search = function () //{{{ liberator.commands.add(["noh[lsearch]"], "Remove the search highlighting", - function () - { - liberator.search.clear(); - }, + function () liberator.search.clear(), { argCount: "0" }); /////////////////////////////////////////////////////////////////////////////}}} diff --git a/content/hints.js b/content/hints.js index 37024e52..4828a240 100644 --- a/content/hints.js +++ b/content/hints.js @@ -567,9 +567,7 @@ liberator.Hints = function () //{{{ liberator.options.add(["hinttimeout", "hto"], "Automatically follow non unique numerical hint", "number", 0, - { - validator: function (value) value >= 0 - }); + { validator: function (value) value >= 0 }); liberator.options.add(["linkfgcolor", "lfc"], "Foreground color of a link during hint mode", diff --git a/content/io.js b/content/io.js index 6c5c3443..ded24518 100644 --- a/content/io.js +++ b/content/io.js @@ -180,9 +180,7 @@ liberator.IO = function () //{{{ } } }, - { - completer: function (filter) liberator.completion.file(filter, true) - }); + { completer: function (filter) liberator.completion.file(filter, true) }); liberator.commands.add(["fini[sh]"], "Stop sourcing a script file", @@ -195,10 +193,7 @@ liberator.IO = function () //{{{ liberator.commands.add(["pw[d]"], "Print the current directory name", - function () - { - liberator.echo(liberator.io.getCurrentDirectory()); - }, + function () liberator.echo(liberator.io.getCurrentDirectory()), { argCount: "0" }); // mkv[imperatorrc] or mkm[uttatorrc] @@ -273,6 +268,7 @@ liberator.IO = function () //{{{ } }, { + bangAllowed: true, completer: function (filter) liberator.completion.file(filter, true) }); @@ -313,7 +309,10 @@ liberator.IO = function () //{{{ if (!found) liberator.echomsg("not found in 'runtimepath': \"" + paths.join(" ") + "\"", 1); // FIXME: should use original arg string }, - { argCount: "+" } + { + argCount: "+", + bangAllowed: true + } ); liberator.commands.add(["scrip[tnames]"], @@ -339,6 +338,7 @@ liberator.IO = function () //{{{ liberator.io.source(args, special); }, { + bangAllowed: true, completer: function (filter) liberator.completion.file(filter, true) }); @@ -361,7 +361,8 @@ liberator.IO = function () //{{{ liberator.echo(command + liberator.util.escapeHTML(output)); liberator.autocommands.trigger("ShellCmdPost", ""); - }); + }, + { bangAllowed: true }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// diff --git a/content/liberator.js b/content/liberator.js index af48a0b4..6626a665 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -104,9 +104,7 @@ const liberator = (function () //{{{ liberator.options.add(["verbose", "vbs"], "Define which info messages are displayed", "number", 0, - { - validator: function (value) value >= 0 && value <= 15 - }); + { validator: function (value) value >= 0 && value <= 15 }); liberator.options.add(["visualbell", "vb"], "Use visual bell instead of beeping on errors", @@ -158,15 +156,12 @@ const liberator = (function () //{{{ liberator.commands.add(["beep"], "Play a system beep", - function () - { - liberator.beep(); - }, + function () liberator.beep(), { argCount: "0" }); liberator.commands.add(["dia[log]"], "Open a " + liberator.config.name + " dialog", - function (args, special) + function (args) { try { @@ -188,7 +183,8 @@ const liberator = (function () //{{{ { return [0, liberator.completion.filter(liberator.config.dialogs || [], filter)]; } - }); + }, + { bangAllowed: true }); // TODO: move this function getMenuItems() @@ -294,7 +290,10 @@ const liberator = (function () //{{{ liberator.echo(usage, liberator.commandline.FORCE_MULTILINE); } }, - { argCount: "0" }); + { + argCount: "0", + bangAllowed: true + }); liberator.commands.add(["h[elp]"], "Display help", @@ -309,6 +308,7 @@ const liberator = (function () //{{{ liberator.help(args); }, { + bangAllowed: true, completer: function (filter) getHelpCompletions(filter) }); @@ -336,17 +336,18 @@ const liberator = (function () //{{{ } }, { + bangAllowed: true, completer: function (filter) liberator.completion.javascript(filter), hereDoc: true, }); liberator.commands.add(["norm[al]"], "Execute Normal mode commands", - function (args, special) + function (args, special) liberator.events.feedkeys(args.string, special), { - liberator.events.feedkeys(args.string, special); - }, - { argCount: "+" }); + argCount: "+", + bangAllowed: true + }); liberator.commands.add(["q[uit]"], liberator.has("tabs") ? "Quit current tab" : "Quit application", @@ -357,14 +358,14 @@ const liberator = (function () //{{{ else liberator.quit(false, special); }, - { argCount: "0" }); + { + argCount: "0", + bangAllowed: true + }); liberator.commands.add(["res[tart]"], "Force " + liberator.config.name + " to restart", - function () - { - liberator.restart(); - }, + function () liberator.restart(), { argCount: "0" }); liberator.commands.add(["time"], @@ -452,6 +453,7 @@ const liberator = (function () //{{{ } }, { + bangAllowed: true, completer: function (filter) { if (/^:/.test(filter)) @@ -472,7 +474,10 @@ const liberator = (function () //{{{ liberator.config.name + " " + liberator.version + " running on:\n" + navigator.userAgent); }, - { argCount: "0" }); + { + argCount: "0", + bangAllowed: true + }); liberator.commands.add(["viu[sage]"], "List all mappings with a short description", @@ -497,7 +502,10 @@ const liberator = (function () //{{{ liberator.echo(usage, liberator.commandline.FORCE_MULTILINE); } }, - { argCount: "0" }); + { + argCount: "0", + bangAllowed: true + }); } function getHelpCompletions(filter) @@ -637,7 +645,7 @@ const liberator = (function () //{{{ return eval("with (liberator) {" + str + "}"); }, - // Execute an ex command like str=":zoom 300" + // Execute an Ex command like str=":zoom 300" execute: function (str, modifiers) { // skip comments and blank lines @@ -664,6 +672,12 @@ const liberator = (function () //{{{ return; } + if (special && !command.bangAllowed) + { + liberator.echoerr("E477: No ! allowed"); + return; + } + // valid command, call it: command.execute(args, special, count, modifiers); }, diff --git a/content/mail.js b/content/mail.js index 54e2a665..eda5213e 100644 --- a/content/mail.js +++ b/content/mail.js @@ -672,9 +672,7 @@ liberator.Mail = function () //{{{ else SelectFolder(folder.URI); }, - { - completer: function (filter) getFolderCompletions(filter) - }); + { completer: function (filter) getFolderCompletions(filter) }); liberator.commands.add(["m[essage]"], "Write a new message", @@ -713,33 +711,26 @@ liberator.Mail = function () //{{{ liberator.commands.add(["copy[to]"], "Copy selected messages", - function (args, special) { moveOrCopy(true, args); }, - { - completer: function (filter) getFolderCompletions(filter) - }); + function (args) moveOrCopy(true, args), + { completer: function (filter) getFolderCompletions(filter) }); liberator.commands.add(["move[to]"], "Move selected messages", - function (args, special) { moveOrCopy(false, args); }, - { - completer: function (filter) getFolderCompletions(filter) - }); + function (args) moveOrCopy(false, args), + { completer: function (filter) getFolderCompletions(filter) }); liberator.commands.add(["empty[trash]"], "Empty trash of the current account", - function () - { - goDoCommand("cmd_emptyTrash"); - }, + function () goDoCommand("cmd_emptyTrash"), { argCount: "0" }); liberator.commands.add(["get[messages]"], "Check for new messages", - function (args, special) + function (args, special) liberator.mail.getNewMessages(!special), { - liberator.mail.getNewMessages(!special); - }, - { argCount: "0" }); + argCount: "0", + bangAllowed: true, + }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// diff --git a/content/mappings.js b/content/mappings.js index 9d956244..49c099df 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -202,14 +202,12 @@ liberator.Mappings = function () //{{{ liberator.commands.add([ch ? ch + "m[ap]" : "map"], "Map a key sequence" + modeDescription, - function (args) { map(args, modes, false); }, - { - completer: function (filter) liberator.completion.userMapping(filter, modes) - }); + function (args) map(args, modes, false), + { completer: function (filter) liberator.completion.userMapping(filter, modes) }); liberator.commands.add([ch + "no[remap]"], "Map a key sequence without remapping keys" + modeDescription, - function (args) { map(args, modes, true); }); + function (args) map(args, modes, true)); liberator.commands.add([ch + "mapc[lear]"], "Remove all mappings" + modeDescription, @@ -242,9 +240,7 @@ liberator.Mappings = function () //{{{ if (!found) liberator.echoerr("E31: No such mapping"); }, - { - completer: function (filter) liberator.completion.userMapping(filter, modes) - }); + { completer: function (filter) liberator.completion.userMapping(filter, modes) }); } /////////////////////////////////////////////////////////////////////////////}}} diff --git a/content/options.js b/content/options.js index d7affbc1..26926ccd 100644 --- a/content/options.js +++ b/content/options.js @@ -366,7 +366,10 @@ liberator.Options = function () //{{{ openPreferences(); } }, - { argCount: "0" }); + { + argCount: "0", + bangAllowed: true, + }); liberator.commands.add(["setl[ocal]"], "Set local option", @@ -375,6 +378,7 @@ liberator.Options = function () //{{{ liberator.commands.get("set").execute(args, special, count, { scope: liberator.options.OPTION_SCOPE_LOCAL }); }, { + bangAllowed: true, completer: function (filter, special, count) { return liberator.commands.get("set").completer(filter, special, count, { scope: liberator.options.OPTION_SCOPE_LOCAL }); @@ -389,6 +393,7 @@ liberator.Options = function () //{{{ liberator.commands.get("set").execute(args, special, count, { scope: liberator.options.OPTION_SCOPE_GLOBAL }); }, { + bangAllowed: true, completer: function (filter, special, count) { return liberator.commands.get("set").completer(filter, special, count, { scope: liberator.options.OPTION_SCOPE_GLOBAL }); @@ -701,6 +706,7 @@ liberator.Options = function () //{{{ } }, { + bangAllowed: true, completer: function (filter, special, count, modifiers) { var optionCompletions = []; @@ -839,7 +845,10 @@ liberator.Options = function () //{{{ delete reference[0][reference[1]]; } }, - { argCount: "+" }); + { + argCount: "+", + bangAllowed: true + }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// diff --git a/content/tabs.js b/content/tabs.js index 3e75dc89..de709715 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -344,6 +344,7 @@ liberator.Tabs = function () //{{{ liberator.tabs.remove(getBrowser().mCurrentTab, count > 0 ? count : 1, special, 0); }, { + bangAllowed: true, completer: function (filter) liberator.completion.buffer(filter) }); @@ -356,16 +357,11 @@ liberator.Tabs = function () //{{{ liberator.execute(args); liberator.forceNewTab = false; }, - { - completer: function (filter) liberator.completion.ex(filter) - }); + { completer: function (filter) liberator.completion.ex(filter) }); liberator.commands.add(["tabl[ast]", "bl[ast]"], "Switch to the last tab", - function () - { - liberator.tabs.select("$", false); - }, + function () liberator.tabs.select("$", false), { argCount: "0" }); // TODO: "Zero count" if 0 specified as arg @@ -431,10 +427,7 @@ liberator.Tabs = function () //{{{ liberator.commands.add(["tabr[ewind]", "tabfir[st]", "br[ewind]", "bf[irst]"], "Switch to the first tab", - function () - { - liberator.tabs.select(0, false); - }, + function () liberator.tabs.select(0, false), { argCount: "0" }); if (liberator.config.name == "Vimperator") @@ -463,32 +456,33 @@ liberator.Tabs = function () //{{{ } }, { + bangAllowed: true, completer: function (filter) liberator.completion.buffer(filter) }); liberator.commands.add(["buffers", "files", "ls", "tabs"], "Show a list of all buffers", - function (args, special) + function (args, special) liberator.tabs.list(special), { - liberator.tabs.list(special); - }, - { argCount: "0" }); + argCount: "0", + bangAllowed: true + }); liberator.commands.add(["quita[ll]", "qa[ll]"], "Quit " + liberator.config.name, - function (args, special) + function (args, special) liberator.quit(false, special), { - liberator.quit(false, special); - }, - { argCount: "0" }); + argCount: "0", + bangAllowed: true + }); liberator.commands.add(["reloada[ll]"], "Reload all tab pages", - function (args, special) + function (args, special) liberator.tabs.reloadAll(special), { - liberator.tabs.reloadAll(special); - }, - { argCount: "0" }); + argCount: "0", + bangAllowed: true + }); // TODO: add count support liberator.commands.add(["tabm[ove]"], @@ -506,14 +500,12 @@ liberator.Tabs = function () //{{{ args = "$"; // if not specified, move to the last tab liberator.tabs.move(getBrowser().mCurrentTab, args, special); - }); + }, + { bangAllowed: true }); liberator.commands.add(["tabo[nly]"], "Close all other tabs", - function () - { - liberator.tabs.keepOnly(getBrowser().mCurrentTab); - }, + function () liberator.tabs.keepOnly(getBrowser().mCurrentTab), { argCount: "0" }); liberator.commands.add(["tabopen", "t[open]", "tabnew", "tabe[dit]"], @@ -530,16 +522,17 @@ liberator.Tabs = function () //{{{ liberator.open("about:blank", where); }, { + bangAllowed: true, completer: function (filter) liberator.completion.url(filter) }); liberator.commands.add(["tabde[tach]"], "Detach current tab to its own window", - function (args, special, count) + function (args, special, count) liberator.tabs.detachTab(null), { - liberator.tabs.detachTab(null); - }, - { argCount: "0" }); + argCount: "0", + bangAllowed: true + }); liberator.commands.add(["tabd[uplicate]"], "Duplicate current tab", @@ -557,7 +550,10 @@ liberator.Tabs = function () //{{{ for (let i = 0; i < count; i++) liberator.tabs.cloneTab(tab, activate); }, - { argCount: "0" }); + { + argCount: "0", + bangAllowed: true + }); } if (liberator.has("session")) @@ -626,7 +622,10 @@ liberator.Tabs = function () //{{{ for (let i = 0; i < undoItems.length; i++) undoCloseTab(); // doesn't work with i as the index to undoCloseTab }, - { argCount: "0" }); + { + argCount: "0", + bangAllowed: true + }); liberator.commands.add(["wqa[ll]", "wq", "xa[ll]"], "Save the session and quit", diff --git a/content/ui.js b/content/ui.js index 8019e7d6..d32ecf57 100644 --- a/content/ui.js +++ b/content/ui.js @@ -328,16 +328,12 @@ liberator.CommandLine = function () //{{{ liberator.options.add(["history", "hi"], "Number of Ex commands and search patterns to store in the command-line history", "number", 500, - { - validator: function (value) value >= 0 - }); + { validator: function (value) value >= 0 }); liberator.options.add(["messages", "msgs"], "Number of messages to store in the message history", "number", 100, - { - validator: function (value) value >= 0 - }); + { validator: function (value) value >= 0 }); liberator.options.add(["more"], "Pause the message list window when more than one screen of listings is displayed", @@ -499,9 +495,7 @@ liberator.CommandLine = function () //{{{ if (str != null) command.action(str); }, - { - completer: function (filter) liberator.completion.javascript(filter) - }); + { completer: function (filter) liberator.completion.javascript(filter) }); }); liberator.commands.add(["mes[sages]"], @@ -514,7 +508,8 @@ liberator.CommandLine = function () //{{{ let list = messageHistory.messages.join("\n"); liberator.commandline.echo(list); - }, { argCount: "0" }); + }, + { argCount: "0" }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// diff --git a/content/vimperator.js b/content/vimperator.js index 38c76d9e..8977e2f7 100644 --- a/content/vimperator.js +++ b/content/vimperator.js @@ -287,6 +287,7 @@ liberator.config = { //{{{ } }, { + bangAllowed: true, completer: function (filter) liberator.completion.url(filter) }); @@ -363,9 +364,7 @@ liberator.config = { //{{{ else liberator.open("about:blank", liberator.NEW_WINDOW); }, - { - completer: function (filter) liberator.completion.url(filter) - }); + { completer: function (filter) liberator.completion.url(filter) }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// OPTIONS /////////////////////////////////////////////////