From 13e504c0a440e205e9545a485038357ddf92ed01 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 10 Sep 2008 18:26:51 +0000 Subject: [PATCH] add commandline completion to 'defsearch' --- NEWS | 1 + content/bookmarks.js | 12 +++++++++++- content/options.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 11b5913c..23cb21e6 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ * version 2.0 (probably) * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and VimperatorLeave respectively + * add commandline completion to 'defsearch' * add 'helpfile' option * add 'wildignore' option * add :finish command diff --git a/content/bookmarks.js b/content/bookmarks.js index f29609a9..bd6f9160 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -100,7 +100,17 @@ liberator.Bookmarks = function () //{{{ liberator.options.add(["defsearch", "ds"], "Set the default search engine", - "string", "google"); + "string", "google", + { + completer: function (filter) + { + return liberator.completion.url("", "s")[1]; + }, + validator: function (value) + { + return liberator.completion.url("", "s")[1].some(function (s) s[0] == value); + } + }); liberator.options.add(["preload"], "Speed up first time history/bookmark completion", diff --git a/content/options.js b/content/options.js index a8fcf0d5..cc447f20 100644 --- a/content/options.js +++ b/content/options.js @@ -700,7 +700,7 @@ liberator.Options = function () //{{{ if (option.hasName(filter)) { if (option.completer) - return [filter.length + 1, option.completer(filter)]; + return [filter.length + 1, option.completer(filter)]; // FIXME: filter should be component after "option=" return [filter.length + 1, [[option.value + "", ""]]]; } }