From bfe94c311d2bca9990530389f91884b0f5124574 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Fri, 31 Jul 2009 18:21:32 +0200 Subject: [PATCH] Add "t" option to 'complete'. Visually it looks odd, that the icons are more indented than others, we might want to remove or at least move the % and # indicators --- common/content/liberator.js | 13 +++++++++++++ common/content/tabs.js | 4 ++++ common/content/ui.js | 2 +- vimperator/NEWS | 4 ++++ vimperator/content/config.js | 1 + vimperator/locale/en-US/browsing.txt | 6 ++++++ vimperator/locale/en-US/options.txt | 5 +++-- 7 files changed, 32 insertions(+), 3 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index 2fe94282..93fa6a65 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1491,7 +1491,20 @@ const liberator = (function () //{{{ // convert the string to an array of converted URLs // -> see util.stringToURLArray for more details if (typeof urls == "string") + { + // rather switch to the tab instead of opening a new url in case of "12: Tab Title" like "urls" + if (liberator.has("tabs")) + { + let matches = urls.match(/^(\d+):/); + if (matches) + { + tabs.select(parseInt(matches[1], 10) - 1, false); // make it zero-based + return; + } + } + urls = util.stringToURLArray(urls); + } if (urls.length > 20 && !force) { diff --git a/common/content/tabs.js b/common/content/tabs.js index 4121c869..598e8c0e 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -645,6 +645,10 @@ function Tabs() //{{{ { argCount: "0" }); } + completion.addUrlCompleter("t", + "Open tabs", + completion.buffer); + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ diff --git a/common/content/ui.js b/common/content/ui.js index 3d115f5a..4ad8e67b 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -770,7 +770,7 @@ function CommandLine() //{{{ options.add(["complete", "cpt"], "Items which are completed at the :open prompts", - "charlist", "slf", + "charlist", typeof(config.defaults["complete"]) == "string" ? config.defaults["complete"] : "slf", { completer: function (context) [k for each (k in completion.urlCompleters)], validator: Option.validateCompleter diff --git a/vimperator/NEWS b/vimperator/NEWS index 05350418..dd2e81ba 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -1,5 +1,6 @@ 2009-XX-XX: * version 2.2a1pre + * IMPORTANT: the 'complete' option's default has changed (again) to "stlf" * IMPORTANT: Map.flags has been replaced with individual properties. Mappings defined in plugins with mappings.add will need to be updated. ................................... @@ -15,7 +16,10 @@ ................................... * IMPORTANT: shifted key notation now matches Vim's behaviour. E.g. and are equivalent, to map the uppercase character use . + (this might change again, as this is REALLY inconsistent, and i don't + know if I like copying bugs) + * new "t" option for 'complete' to also switch to open tabs with :open * add [c]:toolbaropen[c], [c]:toolbarclose[c], and [c]:toolbartoggle[c] * make [c]:open[c] behavior match that of [c]:tabopen[c] and [c]:winopen[c] when no argument is specified diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 06519714..dc417e3c 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -34,6 +34,7 @@ const config = { //{{{ /*** optional options, there are checked for existence and a fallback provided ***/ features: ["bookmarks", "hints", "history", "marks", "quickmarks", "session", "tabs", "tabs_undo", "windows"], defaults: { + complete: "stlf", guioptions: "rb", showtabline: 2, titlestring: "Vimperator" diff --git a/vimperator/locale/en-US/browsing.txt b/vimperator/locale/en-US/browsing.txt index e3137cd9..ff836e96 100644 --- a/vimperator/locale/en-US/browsing.txt +++ b/vimperator/locale/en-US/browsing.txt @@ -59,6 +59,12 @@ tag "linux" and which contain "torvalds". Note that -tags support is only available for tab completion, not for the actual command. The items which are completed on [m][m] are specified in the 'complete' option. + +Sometimes, you might not be aware if you already have a certain page loaded in +some background tab or not. Therefore you can just type [c]:open facebook[c] +and switch to it if Facebook is already open, or otherwise open it (if you +have Facebook in your bookmarks or history cache). This behavior can be turned +off by removing "t" from your 'complete' option. ________________________________________________________________________________ diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index 2c2e308b..cba39048 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -221,7 +221,7 @@ ____ |\'cpt'| |\'complete'| -||'complete' 'cpt'|| charlist (default: slf) +||'complete' 'cpt'|| charlist (default: stlf) ____ Items which are completed at the [c]:open[c] prompts. Available items: @@ -231,7 +231,8 @@ Items which are completed at the [c]:open[c] prompts. Available items: *l* Firefox location bar entries (bookmarks and history sorted in an intelligent way) *b* Bookmarks *h* History -*S* Suggest engines +*S* Search engine suggestions +*t* Open tabs ------------------------------------------------------------------------------------- The order is important, so [c]:set complete=bs[c] would list bookmarks first,