From 277eaa6eb91e05c44b093e5871dca831a1a4aad1 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Tue, 17 Apr 2007 20:07:56 +0000 Subject: [PATCH] Added n and N commands --- ChangeLog | 6 +++++ Donators | 2 +- TODO | 1 + chrome/content/vimperator/commands.js | 32 ++++++++++++++++++++------- chrome/content/vimperator/hints.js | 4 ++-- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index defd5977..e48ad743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@
+date:
+	* version 0.4
+	* added :edit, :e and :tabedit aliases for :open, :tabopen
+	* :open without argument reloads current page, :tabopen opens an empty tab
+	* added 'n' and 'N' to repeat a search
+
 17/04/2007:
 	* version 0.3
 	* added Ctrl-v support to pass one key to firefox (patch by Muthu Kannan)
diff --git a/Donators b/Donators
index b0fffa91..538eb0e3 100644
--- a/Donators
+++ b/Donators
@@ -1,6 +1,6 @@
 
 Note: If you don't wish to appear on this list when making a donation, please tell me.
-Also if you want the amount or email adress or whatever listet, send me an email.
+Also if you want the amount or email address or whatever listet, send me an email.
 
 * Andrew Pantyukhin
 
diff --git a/TODO b/TODO index f2abc513..9265e0d5 100644 --- a/TODO +++ b/TODO @@ -46,5 +46,6 @@ FEATURES: 4 Support multiple top-level windows? 4 :restart command to restart firefox 3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab] + have a look into the split browser extension 3 :set should also set about:config options (with autocomplete)
diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 428f3d52..4303c21a 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -173,7 +173,7 @@ var g_commands = [/*{{{*/ null ], [ - ["open", "o"], + ["open", "o", "op", "ope", "edit", "e"], "Open one ore more URLs", "Usage: :open <url> [| <url>]
" + "Opens one ore more URLs in the current buffer.
"+ @@ -183,8 +183,9 @@ var g_commands = [/*{{{*/ "
  • Opened with the default search engine if the first word is no search engine (:open linus torvalds will open a google search for linux torvalds).
  • "+ "
  • Passed directly to Firefox in all other cases (:open www.osnews.com | www.slashdot.org will open OSNews in the current, and Slashdot in a new background tab).
  • "+ "You WILL be able to use :open [-T \"linux\"] torvalds<Tab> to complete bookmarks with tag \"linux\" and which contain \"torvalds\". Note that -T support is only available for tab completion, not for the actual command.
    "+ - "The items which are completed on <Tab> are specified in the 'complete' option.", - function(args) { if(args) openURLs(args); else reload(false); }, + "The items which are completed on <Tab> are specified in the 'complete' option.
    "+ + "Without argument, reloads the current page.", + function(args) { if(args.length > 0) openURLs(args); else reload(false); }, function(filter) { return get_url_completions(filter); } ], [ @@ -195,7 +196,7 @@ var g_commands = [/*{{{*/ null ], [ - ["quit", "q"], + ["quit", "q", "qu", "qui"], "Quit current tab or quit Vimperator if this was the last tab", "When quitting Vimperator, the session is not stored.", function (args) { tab_remove(1, false, 1); }, @@ -250,10 +251,10 @@ var g_commands = [/*{{{*/ null ], [ - ["tabopen", "t", "to", "topen"], + ["tabopen", "t", "to", "topen", "tabedit"], "Open one or more URLs in a new tab", "Like :open but open URLs in a new tab. If used with !, the 'tabopen' value of the 'activate' setting is negated.", - function (args, special) { openURLsInNewTab(args, !special); }, + function (args, special) { if (args.length > 0) openURLsInNewTab(args, !special); else openURLsInNewTab("about:blank", true); }, function (filter) { return get_url_completions(filter); } ], [ @@ -552,7 +553,7 @@ var g_mappings = [/*{{{*/ [ ["", ""], "Scroll down a page", - "Scroll dow a full page of the current document. No count support for now.", + "Scroll down a full page of the current document. No count support for now.", function(count) { goDoCommand('cmd_scrollPageDown'); } ], @@ -619,6 +620,19 @@ var g_mappings = [/*{{{*/ function(count) { hah.enableHahMode(HINT_MODE_EXTENDED); } ], + /* search managment */ + [ + ["n"], + "Find next", + "Repeat the last \"/\" 1 time (until count is supported).", + function(count) { gFindBar.onFindAgainCmd(); } // this does not work, why?: goDoCommand('cmd_findAgain'); } + ], + [ + ["N"], + "Find previous", + "Repeat the last \"/\" 1 time (until count is supported) in the opposite direction.", + function(count) { gFindBar.onFindPreviousCmd(); } // this does not work, why?: goDoCommand('cmd_findPrevious'); } + ], /* vimperator managment */ [ @@ -880,11 +894,13 @@ function openURLs(str) { urls = stringToURLs(str); if (urls.length == 0) - return; + return false; getWebNavigation().loadURI(urls[0], nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); for (var url=1; url < urls.length; url++) gBrowser.addTab(urls[url]); + + return true; } function openURLsInNewTab(str, activate) diff --git a/chrome/content/vimperator/hints.js b/chrome/content/vimperator/hints.js index 39c9485b..afcf8fd3 100644 --- a/chrome/content/vimperator/hints.js +++ b/chrome/content/vimperator/hints.js @@ -245,7 +245,7 @@ function hit_a_hint() } /* removes all visible hints from doc - * or from current document, if doc == null + * or from current document, if win == null */ function removeHints(win) { @@ -253,7 +253,7 @@ function hit_a_hint() win = window._content; var doc = win.document; - var res = doc.evaluate("//HINTS/SPAN", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE , null); + var res = doc.evaluate("//HINTS/SPAN", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var elem, i; for (i = 0; i < res.snapshotLength; i++)