有谁知道我是否可以将所有与表达式匹配的选项卡移动到另一个选项卡组中?如果是这样,怎么办?
以下Pentadactyl ex文件(带有嵌入式Javascript)应提供一个命令,该命令将使所有选项卡的标签与正则表达式匹配,并将匹配的选项卡移至具有指定ID的组。请注意,匹配不区分大小写。
" tgroup-moveselected.penta
" Provides the command tgroup-moveselected, which moves all tabs matching a
" given regular expression to the group with specified id.
" eg. :tgroup-moveselected "penta" "pentadactyl"
" moves any tabs whose label matches /pentadactyl/ to the group with id "penta"
" Requires the TabGroupie plugin.
command! tgroup-moveselected
\ -nargs=+
\ -description "move tabs matching regex to a given group"
\ -js tgroupMoveSelected(args[0], RegExp(args[1]))
js <<EOF
function getPlugin(s) {
for (x in plugins.contexts) {
if (x.contains(s))
return plugins.contexts[x][s];
}
}
var TabGroupie = getPlugin("TabGroupie");
function matchingTabs(rx) {
var alltabs = tabs.allTabs;
var alltabs = gBrowser.getTabsToTheEndFrom(0);
function matches(t) {
return rx.test(t.label.toLowerCase());
}
var matching = alltabs.filter(matches);
return matching;
}
function matchingTabsInGroup(rx) {
var alltabs = gBrowser.getTabsToTheEndFrom(0);
function matches(t) {
return rx.test(t.label.toLowerCase());
}
var matching = alltabs.filter(matches);
return matching;
}
function tgroupMoveSelected (targetgrp, rx) {
var matching = matchingTabs(rx);
var tgrpId = TabGroupie.getIdByTitle(targetgrp);
var i, t;
for (i=0; i<matching.length; ++i) {
t = matching[i];
TabView.moveTabTo(t, tgrpId);
}
TabView.hide();
}
EOF
我已将其作为Gist上传到Github ,因此,您可以根据需要从那里下载它。
该脚本需要TabGroupie插件。
警告:在我的系统上,放置此插件~/.pentadactyl/plugins
(在Pentadactyl启动时加载)将完全破坏选项卡组的功能。要修复它,我必须禁用Pentadactyl,重新启动FF并重新启用Pentadactyl。解决方法似乎是在Pentadactyl启动后加载TabGroupie (通过将其从/plugins/
目录中删除,并在FF启动后立即进行采购)。
将tgroup-moveselected.penta和TabGroupie.js都保存在~/.pentadactyl
目录中。
将以下行添加到您的.pentadactylrc
:
command! tginit :source ~/.pentadactyl/TabGroupie.js | source ~/.pentadactyl/tgroupmoveselected.penta
启动FF时,可以使用命令初始化Pentadactyl选项卡组功能:tginit
。
如果要频繁使用某个模式和/或选项卡组,则可以创建映射或命令作为快捷方式。例如,如果要C-m用作热键将标题中带有“ pentadactyl”的所有选项卡发送到标识为“ penta”的选项卡组,则可以使用以下命令:
:map <C-m> :tgroup-moveselected "penta" "pentadactyl"<CR>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句