mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 02:47:58 +01:00
added section support for :help
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
<pre>
|
<pre>
|
||||||
date:
|
date:
|
||||||
* version 0.4
|
* version 0.4
|
||||||
|
* :help <section> supported, :help set will show help for the :set command
|
||||||
|
(patch from Viktor Kojouharov)
|
||||||
* :source support, and auto-sourcing ~/.vimperatorrc on startup
|
* :source support, and auto-sourcing ~/.vimperatorrc on startup
|
||||||
* fixed saving of session
|
* fixed saving of session
|
||||||
* fixed hints display when zooming in/out of a web page
|
* fixed hints display when zooming in/out of a web page
|
||||||
|
|||||||
1
Donators
1
Donators
@@ -4,6 +4,7 @@ Also if you want the amount or email address or whatever listet, send me an emai
|
|||||||
|
|
||||||
* Andrew Pantyukhin
|
* Andrew Pantyukhin
|
||||||
* Ben Klemens
|
* Ben Klemens
|
||||||
|
* Sjoerd Siebinga
|
||||||
|
|
||||||
I want to say a big <b>THANK YOU</b> for all people which supported this project in this way.
|
I want to say a big <b>THANK YOU</b> for all people which supported this project in this way.
|
||||||
</pre>
|
</pre>
|
||||||
|
|||||||
1
TODO
1
TODO
@@ -42,6 +42,7 @@ FEATURES:
|
|||||||
5 Sort :open completion by date?
|
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 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
|
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?
|
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]
|
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
|
have a look into the split browser extension
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ var g_commands = [/*{{{*/
|
|||||||
"Open help window",
|
"Open help window",
|
||||||
"Open the help window in the current tab. You WILL be able to show a specific section with <code class=command>:help commands</code>.",
|
"Open the help window in the current tab. You WILL be able to show a specific section with <code class=command>:help commands</code>.",
|
||||||
help,
|
help,
|
||||||
null
|
function(filter) { return get_help_completions(filter); }
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
["history", "hs"],
|
["history", "hs"],
|
||||||
@@ -281,6 +281,7 @@ var g_commands = [/*{{{*/
|
|||||||
[
|
[
|
||||||
["source", "so"],
|
["source", "so"],
|
||||||
"Load a local javascript file and execute it",
|
"Load a local javascript file and execute it",
|
||||||
|
"The .vimperatorrc file in your home directory is always sourced at start up.<br>"+
|
||||||
"~ is supported as a shortcut for the $HOME directory.",
|
"~ is supported as a shortcut for the $HOME directory.",
|
||||||
source,
|
source,
|
||||||
null
|
null
|
||||||
@@ -1027,7 +1028,7 @@ function stringToURLs(str)
|
|||||||
matches = urls[url].match(regex);
|
matches = urls[url].match(regex);
|
||||||
if(matches != null)
|
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;
|
break begin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1035,7 +1036,7 @@ function stringToURLs(str)
|
|||||||
/* if the string contains a space or does not conatain any of: .:/
|
/* if the string contains a space or does not conatain any of: .:/
|
||||||
* open it with default searchengine */
|
* open it with default searchengine */
|
||||||
if (urls[url].match(/\s+/) || urls[url].match(/\.|:|\//) == null)
|
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;
|
return urls;
|
||||||
}
|
}
|
||||||
@@ -1677,7 +1678,7 @@ table.settings th {\
|
|||||||
'<p align=center bgcolor=blue borderwidth=1><b>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 :)</b></p>'
|
'<p align=center bgcolor=blue borderwidth=1><b>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 :)</b></p>'
|
||||||
|
|
||||||
var introduction = '<h2>Introduction</h2>' +
|
var introduction = '<h2>Introduction</h2>' +
|
||||||
'<p>Vimperator is a free browser add-on for Firefox, which makes it look and behave like the <a href="http://www.vim.org">Vim</a> text editor. ' +
|
'<p><a href="http://vimperator.mozdev.net">Vimperator</a> is a free browser add-on for Firefox, which makes it look and behave like the <a href="http://www.vim.org">Vim</a> 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.</p>' +
|
'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.</p>' +
|
||||||
|
|
||||||
'<p><font color=red><b>Warning:</b></font> To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden. If you really need them, type: <code class=command>:set guioptions=mT</code> to get it back. ' +
|
'<p><font color=red><b>Warning:</b></font> To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden. If you really need them, type: <code class=command>:set guioptions=mT</code> to get it back. ' +
|
||||||
@@ -1720,9 +1721,9 @@ table.settings th {\
|
|||||||
cmd_name = cmd_name.replace(/</g, "<");
|
cmd_name = cmd_name.replace(/</g, "<");
|
||||||
cmd_name = cmd_name.replace(/>/g, ">");
|
cmd_name = cmd_name.replace(/>/g, ">");
|
||||||
if (j==0) // color the first item differently
|
if (j==0) // color the first item differently
|
||||||
command += "<font color='" + color + "'><b><code>" +beg+ cmd_name +end+ '</code></b></font><br>';
|
command += "<font color='" + color + "'><b><code id='" + commands[i][0][j] + "'>" +beg+ cmd_name +end+ '</code></b></font><br>';
|
||||||
else
|
else
|
||||||
command += "<code>" +beg+ cmd_name +end+ '</code><br>';
|
command += "<code id='" + commands[i][0][j] + "'>" +beg+ cmd_name +end+ '</code><br>';
|
||||||
}
|
}
|
||||||
ret += command + '</td><td>';
|
ret += command + '</td><td>';
|
||||||
if (commands[i][1])
|
if (commands[i][1])
|
||||||
@@ -1762,10 +1763,17 @@ table.settings th {\
|
|||||||
'<p><table class="vimperator mappings">'
|
'<p><table class="vimperator mappings">'
|
||||||
mappings += makeHelpString(g_mappings, "#102663", "", "", null);
|
mappings += makeHelpString(g_mappings, "#102663", "", "", null);
|
||||||
mappings += '</table></p>';
|
mappings += '</table></p>';
|
||||||
|
if (section && section == 'holy-grail')
|
||||||
|
mappings += '<span id="holy-grail">You found it, Arthur!</span>';
|
||||||
|
|
||||||
var commands = '<h2>Commands</h2><p><table class="vimperator commands">'
|
var commands = '<h2>Commands</h2><p><table class="vimperator commands">'
|
||||||
commands += makeHelpString(g_commands, "#632610", ":", "", null);
|
commands += makeHelpString(g_commands, "#632610", ":", "", null);
|
||||||
commands += '</table></p>';
|
commands += '</table></p>';
|
||||||
|
if (section && section == '42')
|
||||||
|
commands += '<p id="42">What is the meaning of life, the universe and everything?<br/>' +
|
||||||
|
'Douglas Adams, the only person who knew what this question really was about is<br/>' +
|
||||||
|
'now dead, unfortunately. So now you might wonder what the meaning of death<br/>' +
|
||||||
|
'is...</p>';
|
||||||
|
|
||||||
var settings = '<h2>Settings</h2><p><table class="vimperator settings">'
|
var settings = '<h2>Settings</h2><p><table class="vimperator settings">'
|
||||||
settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
|
settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
|
||||||
@@ -1784,9 +1792,31 @@ table.settings th {\
|
|||||||
doc.open();
|
doc.open();
|
||||||
doc.write(fulldoc);
|
doc.write(fulldoc);
|
||||||
doc.close();
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -302,6 +302,26 @@ function get_bookmark_completions(filter)/*{{{*/
|
|||||||
return filter_url_array(g_bookmarks, filter, true);
|
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)/*{{{*/
|
function get_history_completions(filter)/*{{{*/
|
||||||
{
|
{
|
||||||
var history = document.getElementById("hiddenHistoryTree");
|
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 :(
|
// commands should be sorted anyway, but it doesn't really hurt -> it DOES hurt :(
|
||||||
//g_completions.sort();
|
//g_completions.sort();
|
||||||
|
return g_completions;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
function get_settings_completions(filter)/*{{{*/
|
function get_settings_completions(filter)/*{{{*/
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ nsBrowserStatusHandler.prototype =
|
|||||||
else if (aFlag & nsIWebProgressListener.STATE_STOP)
|
else if (aFlag & nsIWebProgressListener.STATE_STOP)
|
||||||
{
|
{
|
||||||
updateStatusbar();
|
updateStatusbar();
|
||||||
|
// also reset the buffer list, since the url titles are valid here
|
||||||
|
buffer_preview_update();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
@@ -261,9 +263,6 @@ function init()
|
|||||||
g_history.unshift([url, title]);
|
g_history.unshift([url, title]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// also reset the buffer list, since the url titles are valid here
|
|
||||||
if (g_bufshow)
|
|
||||||
bufshow("", false);
|
|
||||||
}
|
}
|
||||||
, null);
|
, null);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user