diff --git a/ChangeLog b/ChangeLog index 6b2dedea..bbbfea8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@
 date:
 	* version 0.4
+	* :help 
supported, :help set will show help for the :set command + (patch from Viktor Kojouharov) * :source support, and auto-sourcing ~/.vimperatorrc on startup * fixed saving of session * fixed hints display when zooming in/out of a web page diff --git a/Donators b/Donators index e9f3f288..0eef52a6 100644 --- a/Donators +++ b/Donators @@ -4,6 +4,7 @@ Also if you want the amount or email address or whatever listet, send me an emai * Andrew Pantyukhin * Ben Klemens +* Sjoerd Siebinga I want to say a big THANK YOU for all people which supported this project in this way.
diff --git a/TODO b/TODO index 2ea0a993..5c3285d8 100644 --- a/TODO +++ b/TODO @@ -42,6 +42,7 @@ FEATURES: 5 Sort :open completion by date? 5 make use of the ] and [ keys to e.g. jump to the next heading ]], next image ]i, previous textbox [t and so on 5 add tag support to adding/deleting bookmarks +4 change :exec to behave more vim like, and add a seperate :javascript << EOF command 4 Support multiple top-level windows? 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 diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 28b1cb68..a70e5d86 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -161,7 +161,7 @@ var g_commands = [/*{{{*/ "Open help window", "Open the help window in the current tab. You WILL be able to show a specific section with :help commands.", help, - null + function(filter) { return get_help_completions(filter); } ], [ ["history", "hs"], @@ -281,6 +281,7 @@ var g_commands = [/*{{{*/ [ ["source", "so"], "Load a local javascript file and execute it", + "The .vimperatorrc file in your home directory is always sourced at start up.
"+ "~ is supported as a shortcut for the $HOME directory.", source, null @@ -1027,7 +1028,7 @@ function stringToURLs(str) matches = urls[url].match(regex); if(matches != null) { - urls[url] = g_searchengines[i][1].replace(/%s/, matches[1]); + urls[url] = g_searchengines[i][1].replace(/%s/, encodeURIComponent(matches[1])); break begin; } } @@ -1035,7 +1036,7 @@ function stringToURLs(str) /* if the string contains a space or does not conatain any of: .:/ * open it with default searchengine */ if (urls[url].match(/\s+/) || urls[url].match(/\.|:|\//) == null) - urls[url] = g_searchengines[0][1].replace(/%s/, urls[url]); + urls[url] = g_searchengines[0][1].replace(/%s/, encodeURIComponent(urls[url])); } return urls; } @@ -1299,7 +1300,7 @@ function buffer_preview_toggle() function buffer_preview_update(event) { if(g_bufshow == true) - bufshow("",false); + bufshow("", false); } // adds listeners to buffer actions. @@ -1677,7 +1678,7 @@ table.settings th {\ '

First there was a Navigator, then there was an Explorer. Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)

' var introduction = '

Introduction

' + - '

Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. ' + + '

Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. ' + 'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.

' + '

Warning: To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden. If you really need them, type: :set guioptions=mT to get it back. ' + @@ -1720,9 +1721,9 @@ table.settings th {\ cmd_name = cmd_name.replace(//g, ">"); if (j==0) // color the first item differently - command += "" +beg+ cmd_name +end+ '
'; + command += "" +beg+ cmd_name +end+ '
'; else - command += "" +beg+ cmd_name +end+ '
'; + command += "" +beg+ cmd_name +end+ '
'; } ret += command + ''; if (commands[i][1]) @@ -1762,10 +1763,17 @@ table.settings th {\ '

' mappings += makeHelpString(g_mappings, "#102663", "", "", null); mappings += '

'; + if (section && section == 'holy-grail') + mappings += 'You found it, Arthur!'; var commands = '

Commands

' commands += makeHelpString(g_commands, "#632610", ":", "", null); commands += '

'; + if (section && section == '42') + commands += '

What is the meaning of life, the universe and everything?
' + + 'Douglas Adams, the only person who knew what this question really was about is
' + + 'now dead, unfortunately. So now you might wonder what the meaning of death
' + + 'is...

'; var settings = '

Settings

' settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString); @@ -1784,9 +1792,31 @@ table.settings th {\ doc.open(); doc.write(fulldoc); doc.close(); + if (section) + { + var element = doc.getElementById(section); + if (!element) + { + echoerr("E149: Sorry, no help for " + section); + return; + } + var pos = cumulativeOffset(element); + window.content.scrollTo(pos[0], pos[1]); + } } +function cumulativeOffset(element) { + var valueT = 0, valueL = 0; + if (!element) return [0, 0]; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return [valueL, valueT]; +} + diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js index d612f892..3f85585f 100644 --- a/chrome/content/vimperator/completion.js +++ b/chrome/content/vimperator/completion.js @@ -302,6 +302,26 @@ function get_bookmark_completions(filter)/*{{{*/ return filter_url_array(g_bookmarks, filter, true); }/*}}}*/ +function get_help_completions(filter) +{ + var help_completions = []; + help_completions = help_completions.concat(get_command_completions(filter)); + help_completions = help_completions.concat(get_settings_completions(filter)); + for(var i = 0; i < g_mappings.length; i++) + { + for(var j = 0; j < g_mappings[i][0].length; j++) + { + //var re = new RegExp("^" + filter); + if (g_mappings[i][0][j].indexOf(filter) == 0) + { + help_completions.push([g_mappings[i][0][j], g_mappings[i][1]]); + break; // only add a command once + } + } + } + return help_completions; +} + function get_history_completions(filter)/*{{{*/ { var history = document.getElementById("hiddenHistoryTree"); @@ -372,6 +392,7 @@ function get_command_completions(filter)/*{{{*/ } // commands should be sorted anyway, but it doesn't really hurt -> it DOES hurt :( //g_completions.sort(); + return g_completions; }/*}}}*/ function get_settings_completions(filter)/*{{{*/ diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index 9d5f3f12..74c2fe5b 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -118,6 +118,8 @@ nsBrowserStatusHandler.prototype = else if (aFlag & nsIWebProgressListener.STATE_STOP) { updateStatusbar(); + // also reset the buffer list, since the url titles are valid here + buffer_preview_update(); } return 0; }, @@ -261,9 +263,6 @@ function init() g_history.unshift([url, title]); } - // also reset the buffer list, since the url titles are valid here - if (g_bufshow) - bufshow("", false); } , null);