命令是close_others_by_index
。不幸的是,它接受的参数不能通过简单的键绑定传递。
要使其工作,您必须创建一个插件。Tools/New Plugin...
:
import sublime_plugin
class CloseOthersCommand(sublime_plugin.TextCommand):
def run(self, edit):
window = self.view.window()
group_index, view_index = window.get_view_index(self.view)
window.run_command("close_others_by_index", { "group": group_index, "index": view_index})
保存在Packages/User
目录中。然后你可以添加你的键绑定:
{ "keys": ["super+alt+w"], "command": "close_others" }
“关闭右侧的选项卡”也是如此。命令是close_to_right_by_index
。
插件:
import sublime_plugin
class CloseToRightCommand(sublime_plugin.TextCommand):
def run(self, edit):
window = self.view.window()
group_index, view_index = window.get_view_index(self.view)
window.run_command("close_to_right_by_index", { "group": group_index, "index": view_index})
键绑定:
{ "keys": ["super+alt+shift+w"], "command": "close_to_right" }