mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 02:07:59 +01:00
* merged ctrl-x/a commands
* fixes for file:/ handling * fixed gu and gU
This commit is contained in:
9
NEWS
9
NEWS
@@ -1,13 +1,15 @@
|
|||||||
<pre>
|
<pre>
|
||||||
2007-xx-xx:
|
2007-xx-xx:
|
||||||
* version 0.6
|
* version 0.6
|
||||||
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
|
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0 beta1 or newer
|
||||||
* IMPORTANT! options are no longer automatically stored - use the
|
* IMPORTANT: options are no longer automatically stored - use the
|
||||||
~/.vimperatorrc file instead for persistent options
|
~/.vimperatorrc file instead for persistent options
|
||||||
* IMPORTANT! Major hints rewrite
|
* IMPORTANT: Major hints rewrite
|
||||||
read up the new help for the f, F and ; commands for details
|
read up the new help for the f, F and ; commands for details
|
||||||
removed the following hint options: 'hintchars' 'maxhints'
|
removed the following hint options: 'hintchars' 'maxhints'
|
||||||
added the following hint options: 'hinttimeout'
|
added the following hint options: 'hinttimeout'
|
||||||
|
* IMPORTANT: changed 'I' key to Ctrl-Q to also work in textboxes
|
||||||
|
* new ctrl-x and ctrl-a mappings to increment the last number in the URL
|
||||||
* new ~ mapping to open the home directory
|
* new ~ mapping to open the home directory
|
||||||
* :open tries to open a relative filename now, if you do a :open foo.html
|
* :open tries to open a relative filename now, if you do a :open foo.html
|
||||||
or :open ../hello.txt;
|
or :open ../hello.txt;
|
||||||
@@ -24,7 +26,6 @@
|
|||||||
* tags and keyword support for :bmark
|
* tags and keyword support for :bmark
|
||||||
* added full zoom, and changed keybindings slightly for text zoom
|
* added full zoom, and changed keybindings slightly for text zoom
|
||||||
* improvements for scrollable -- more -- prompt
|
* improvements for scrollable -- more -- prompt
|
||||||
* changed 'I' key to Ctrl-Q to also work in textboxes
|
|
||||||
* sites like msn.com or yahoo.com don't focus search field anymore on keydown
|
* sites like msn.com or yahoo.com don't focus search field anymore on keydown
|
||||||
* new gi browser command to focus last used input box
|
* new gi browser command to focus last used input box
|
||||||
* edit TEXTAREAs with many vim commands in a vim and even visual mode if you :set noinsertmode
|
* edit TEXTAREAs with many vim commands in a vim and even visual mode if you :set noinsertmode
|
||||||
|
|||||||
3
TODO
3
TODO
@@ -40,9 +40,6 @@ RANDOM IDEAS:
|
|||||||
* numbered tabs
|
* numbered tabs
|
||||||
* Would it be possible to add a setting "maxcompletionsshown" and
|
* Would it be possible to add a setting "maxcompletionsshown" and
|
||||||
"maxpreviewwindowheight" or something like this?
|
"maxpreviewwindowheight" or something like this?
|
||||||
* 16:06:04 bartman| maxauthority: feature idea: what if :n and :N searched the
|
|
||||||
page and if they found a unique href=*next.* or
|
|
||||||
href=.*prev.* they would follow that link?
|
|
||||||
* hide scrollbars: http://rafb.net/p/YHRhEe47.html (window.content.document.body.style.overflow = "hidden")
|
* hide scrollbars: http://rafb.net/p/YHRhEe47.html (window.content.document.body.style.overflow = "hidden")
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ vimperator.IO = function () //{{{
|
|||||||
if (!/^(file:|[a-zA-Z]:|\/)/.test(path)) // starts not with either /, C: or file:
|
if (!/^(file:|[a-zA-Z]:|\/)/.test(path)) // starts not with either /, C: or file:
|
||||||
path = this.getCurrentDirectory() + (WINDOWS ? "\\" : "/") + path; // TODO: for now homedir, later relative to current dir?
|
path = this.getCurrentDirectory() + (WINDOWS ? "\\" : "/") + path; // TODO: for now homedir, later relative to current dir?
|
||||||
else
|
else
|
||||||
path = path.replace(/^file:/, "");
|
path = path.replace(/^file:(\/\/)?/, "");
|
||||||
|
|
||||||
file.initWithPath(path);
|
file.initWithPath(path);
|
||||||
return file;
|
return file;
|
||||||
|
|||||||
@@ -872,6 +872,44 @@ vimperator.Mappings = function () //{{{
|
|||||||
"Works like <code class=\"command\">:xall</code>."
|
"Works like <code class=\"command\">:xall</code>."
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
function incrementURL(count)
|
||||||
|
{
|
||||||
|
var url = vimperator.buffer.URL;
|
||||||
|
var regex = /(.*?)(-?\d+)(\D*)$/;
|
||||||
|
|
||||||
|
var res = url.match(regex);
|
||||||
|
if(!res || !res[2]) // no number to increment
|
||||||
|
{
|
||||||
|
vimperator.beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newNum = parseInt(res[2], 10) + count + ""; // "" to make sure its a string
|
||||||
|
var nums = newNum.match(/^(-?)(\d+)$/);
|
||||||
|
var oldLength = res[2].replace(/-/, "").length, newLength = nums[2].length;
|
||||||
|
newNum = nums[1] || "";
|
||||||
|
for (let i = 0; i < oldLength - newLength; i++)
|
||||||
|
newNum += "0"; // keep leading zeros
|
||||||
|
newNum += nums[2];
|
||||||
|
|
||||||
|
vimperator.open(res[1] + newNum + res[3]);
|
||||||
|
}
|
||||||
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-x>"],
|
||||||
|
function (count) { if(count < 1) count = 1; incrementURL(-count); },
|
||||||
|
{
|
||||||
|
shortHelp: "Decrement last number in URL",
|
||||||
|
help: "Decrements the last number in URL by 1, or by <code class=\"argument\">count</code> if given.",
|
||||||
|
flags: vimperator.Mappings.flags.COUNT
|
||||||
|
}
|
||||||
|
));
|
||||||
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-a>"],
|
||||||
|
function (count) { if(count < 1) count = 1; incrementURL(count); },
|
||||||
|
{
|
||||||
|
shortHelp: "Increment last number in URL",
|
||||||
|
help: "Increments the last number in URL by 1, or by <code class=\"argument\">count</code> if given.",
|
||||||
|
flags: vimperator.Mappings.flags.COUNT
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
// scrolling commands
|
// scrolling commands
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["0", "^"],
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["0", "^"],
|
||||||
@@ -1042,37 +1080,44 @@ vimperator.Mappings = function () //{{{
|
|||||||
flags: vimperator.Mappings.flags.COUNT
|
flags: vimperator.Mappings.flags.COUNT
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
function isDirectory(url)
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gu"],
|
||||||
{
|
|
||||||
if (/^file:\/\/|^\//.test(url))
|
|
||||||
{
|
|
||||||
var strippedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
|
||||||
var file = vimperator.io.getFile(strippedFilename);
|
|
||||||
if (!file || !file.isDirectory())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// for all other locations just check if the URL ends with /
|
|
||||||
return /\/$/.test(url);
|
|
||||||
}
|
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gu", "<BS>"],
|
|
||||||
function (count)
|
function (count)
|
||||||
{
|
{
|
||||||
var gocmd = "";
|
function isDirectory(url)
|
||||||
if (isDirectory(vimperator.buffer.URL))
|
{
|
||||||
gocmd = "../";
|
if (/^file:\/|^\//.test(url))
|
||||||
else
|
{
|
||||||
gocmd = "./";
|
//var strippedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
||||||
|
var file = vimperator.io.getFile(url);
|
||||||
|
if (!file.exists() || !file.isDirectory())
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for all other locations just check if the URL ends with /
|
||||||
|
return /\/$/.test(url);
|
||||||
|
}
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
count = 1;
|
count = 1;
|
||||||
|
|
||||||
for (var i = 0; i < count - 1; i++)
|
var url = vimperator.buffer.URL;
|
||||||
gocmd += "../";
|
for (var i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (isDirectory(url))
|
||||||
|
url = url.replace(/^(.*?:)(.*?)([^\/]+\/*)$/, "$1$2/")
|
||||||
|
else
|
||||||
|
url = url.replace(/^(.*?:)(.*?)(\/+[^\/]+)$/, "$1$2/")
|
||||||
|
}
|
||||||
|
url = url.replace(/^(.*:\/+.*?)\/+$/, "$1/"); // get rid of more than 1 / at the end
|
||||||
|
|
||||||
vimperator.open(gocmd);
|
if (url == vimperator.buffer.URL)
|
||||||
|
{
|
||||||
|
vimperator.beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vimperator.open(url);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
shortHelp: "Go to parent directory",
|
shortHelp: "Go to parent directory",
|
||||||
@@ -1080,12 +1125,21 @@ vimperator.Mappings = function () //{{{
|
|||||||
flags: vimperator.Mappings.flags.COUNT
|
flags: vimperator.Mappings.flags.COUNT
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gU", "<C-BS>"],
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gU"],
|
||||||
function () { vimperator.open("..."); },
|
function ()
|
||||||
|
{
|
||||||
|
var uri = content.document.location;
|
||||||
|
if (/(about|mailto):/.test(uri.protocol)) // exclude these special protocols for now
|
||||||
|
{
|
||||||
|
vimperator.beep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vimperator.open(uri.protocol + "//" + (uri.host || "") + "/");
|
||||||
|
},
|
||||||
{
|
{
|
||||||
shortHelp: "Go to the root of the website",
|
shortHelp: "Go to the root of the website",
|
||||||
help: "<code class=\"mapping\">gU</code> on <code>http://www.example.com/dir1/dir2/file.htm</code> opens <code>http://www.example.com/</code>.<br/>" +
|
help: "<code class=\"mapping\">gU</code> on <code>http://www.example.com/dir1/dir2/file.htm</code> opens <code>http://www.example.com/</code>.<br/>" +
|
||||||
"When browsing a local directory, it goes to the root document."
|
"When browsing a local directory, it goes to the root directory."
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -98,21 +98,19 @@ vimperator.util = { //{{{
|
|||||||
|
|
||||||
begin: for (var url = 0; url < urls.length; url++)
|
begin: for (var url = 0; url < urls.length; url++)
|
||||||
{
|
{
|
||||||
var newURL = vimperator.buffer.URL;
|
|
||||||
var matches;
|
|
||||||
|
|
||||||
// strip each 'URL' - makes things simpler later on
|
// strip each 'URL' - makes things simpler later on
|
||||||
urls[url] = urls[url].replace(/^\s+/, "").replace(/\s+$/, "");
|
urls[url] = urls[url].replace(/^\s+/, "").replace(/\s+$/, "");
|
||||||
|
|
||||||
// first check if it is an existing local file
|
// first check if it is an existing local file
|
||||||
var file = vimperator.io.getFile(urls[url]);
|
var file = vimperator.io.getFile(urls[url]);
|
||||||
if (file.exists())
|
if (file.exists() && file.isReadable())
|
||||||
{
|
{
|
||||||
urls[url] = file.path;
|
urls[url] = file.path;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabled for now, use gu and GU or O and change the last part
|
// Disabled for now, use gu and GU or O and change the last part
|
||||||
|
// var newURL = vimperator.buffer.URL;
|
||||||
// // FIXME: not really that good (doesn't handle .. in the middle)
|
// // FIXME: not really that good (doesn't handle .. in the middle)
|
||||||
// // check for ./ and ../ (or even .../) to go to a file in the upper directory
|
// // check for ./ and ../ (or even .../) to go to a file in the upper directory
|
||||||
// if (matches = urls[url].match(/^(?:\.$|\.\/(\S*))/))
|
// if (matches = urls[url].match(/^(?:\.$|\.\/(\S*))/))
|
||||||
@@ -138,6 +136,7 @@ vimperator.util = { //{{{
|
|||||||
// if the string doesn't look like a valid URL (i.e. contains a space
|
// if the string doesn't look like a valid URL (i.e. contains a space
|
||||||
// or does not contain any of: .:/) try opening it with a search engine
|
// or does not contain any of: .:/) try opening it with a search engine
|
||||||
// or keyword bookmark
|
// or keyword bookmark
|
||||||
|
var matches;
|
||||||
if (/\s/.test(urls[url]) || !/[.:\/]/.test(urls[url]))
|
if (/\s/.test(urls[url]) || !/[.:\/]/.test(urls[url]))
|
||||||
{
|
{
|
||||||
matches = urls[url].match(/^(\S+)(?:\s+(.+))?$/);
|
matches = urls[url].match(/^(\S+)(?:\s+(.+))?$/);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<em:targetApplication>
|
<em:targetApplication>
|
||||||
<Description>
|
<Description>
|
||||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||||
<em:minVersion>3.0a7</em:minVersion>
|
<em:minVersion>3.0b1</em:minVersion>
|
||||||
<em:maxVersion>3.0.0.*</em:maxVersion>
|
<em:maxVersion>3.0.0.*</em:maxVersion>
|
||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
|
|||||||
Reference in New Issue
Block a user