我正在使用 Firefox,并安装了 vimperator。很好,但我找不到使用热键关闭右侧标签的方法。你能告诉我怎么做吗?谢谢。
问问题
530 次
2 回答
4
全部关闭到右/左。
将以下代码放入您的.vimperatorrc
文件中。它分别定义了命令:closealltoright
和:closealltoleft
绑定。根据需要在从“map”开始的行中更改绑定到底部。v>v<
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 to left
map v< :js closeAllToLeft()<CR>
" close tabs to right
map v> :js closeAllToRight()<CR>
command! closealltoright :js closeAllToRight()
command! closealltoleft :js closeAllToLeft()
我已将这两个命令作为Gist上传。
五指版本。
command! closetabstoleft
\ -description "Close all tabs to the left of the current tab"
\ -js
\ var firstTab = tabs.getTab(0);
\ var numToClose = tabs.getTab().dactylOrdinal - 1;
\ tabs.remove(firstTab, numToClose);
command! closetabstoright
\ -description "Close all tabs to the right of the 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
为了方便起见,我把这些放在了一个要点中。
更多选项卡命令可以在我的Pentadactyl 文件夹中找到(命令和绑定在 中.pentadactylrc
,但可能依赖于中定义的函数utils.js
)。
于 2016-02-27T13:07:32.773 回答
0
添加map <your_key_binding> gt :bd -s left<CR>
到您的 vimperatorrc。
解释:
gt
切换到下一个右侧选项卡,:bd -s left
删除此选项卡,然后切换到左侧选项卡。
于 2015-11-29T09:02:13.397 回答