firefox - How to close tabs to the right using vimperator? -
i'm using firefox, , installed vimperator. it's great, can't found method close tabs right using hotkey. please tell me how this? thanks.
close right/left.
place following code in .vimperatorrc
file. defines commands :closealltoright
, :closealltoleft
bindings v> , v< respectively. change bindings desired in lines beginning "map" towards bottom.
js <<eof closealltoright = function () { var current = tabs.gettab(); var currentix = tabs.index(current); var nexttab = current.nextelementsibling; var n = tabs.count; var numtoclose = n - (currentix + 1); tabs.remove(nexttab, numtoclose); } closealltoleft = function () { var current = tabs.gettab(); var currentix = tabs.index(current); var firsttab = tabs.gettab(0); var n = tabs.count; var numtoclose = currentix; tabs.remove(firsttab, numtoclose); } eof " close tabs left map v< :js closealltoleft()<cr> " close tabs right map v> :js closealltoright()<cr> command! closealltoright :js closealltoright() command! closealltoleft :js closealltoleft()
i've uploaded these 2 commands gist.
pentadactyl version.
command! closetabstoleft \ -description "close tabs left of current tab" \ -js \ var firsttab = tabs.gettab(0); \ var numtoclose = tabs.gettab().dactylordinal - 1; \ tabs.remove(firsttab, numtoclose); command! closetabstoright \ -description "close tabs right of current tab" \ -js \ tabindex = tabs.gettab().dactylordinal - 1; \ var nexttabindex = tabindex + 1; \ var firsttab = tabs.gettab(nexttabindex); \ var n = tabs.alltabs.length; \ var numtoclose = n - nexttabindex; \ tabs.remove(firsttab, numtoclose); map v< -ex closetabstoleft map v> -ex closetabstoright
i've placed these in gist convenience.
further tab commands can found in pentadactyl folder (the commands , bindings in .pentadactylrc
, may rely on functions defined in utils.js
).
Comments
Post a Comment