diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index eec41bf1..c4642105 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -1205,6 +1205,7 @@ function focusNextFrame(count, forward) return; // remove all unfocusable frames + // TODO: find a better way to do this var start = document.commandDispatcher.focusedWindow; frames = frames.filter(function(frame) { frame.focus(); @@ -1292,36 +1293,6 @@ function getCurrentTitle() } -function goUp(count) -{ - var gocmd = ""; - if (isDirectory(getCurrentLocation())) - gocmd = "../"; - else - gocmd = "./"; - - if (count < 1) - count = 1; - - for (var i = 0; i < count - 1; i--) - gocmd += "../"; - - openURLs(gocmd); -} - -function yankCurrentLocation() -{ - var loc = getCurrentLocation(); - copyToClipboard(loc); - vimperator.echo("Yanked " + loc); -} -function yankCurrentSelection() -{ - var sel = window.content.document.getSelection(); - copyToClipboard(sel); - vimperator.echo("Yanked " + sel); -} - /////////////////////////////////////////////////////////////////////}}} // scrolling /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{ diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js index f62d994b..e2ec92da 100644 --- a/chrome/content/vimperator/mappings.js +++ b/chrome/content/vimperator/mappings.js @@ -423,14 +423,24 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["y"], - yankCurrentLocation, + function() + { + var loc = getCurrentLocation(); + copyToClipboard(loc); + vimperator.echo("Yanked " + loc); + }, { short_help: "Yank current location to the clipboard", help: "Under UNIX the location is also put into the selection, which can be pasted with the middle mouse button." } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["Y"], - yankCurrentSelection, + function() + { + var sel = window.content.document.getSelection(); + copyToClipboard(sel); + vimperator.echo("Yanked " + sel); + }, { short_help: "Copy selected text", help: "The currently selected text is copied to the system clipboard." @@ -604,7 +614,22 @@ function Mappings() //{{{ } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["gu", ""], - goUp, + function(count) + { + var gocmd = ""; + if (isDirectory(getCurrentLocation())) + gocmd = "../"; + else + gocmd = "./"; + + if (count < 1) + count = 1; + + for (var i = 0; i < count - 1; i--) + gocmd += "../"; + + openURLs(gocmd); + }, { short_help: "Go to parent directory", help: "Count is supported, 2gu on http://www.example.com/dir1/dir2/file.htm would open http://www.example.com/dir1/.",