如何在 Sublime text 4 中进行反转选择?

问题描述

在以前的 Sublime Text 版本 (ST3) 中,选择菜单中有反向选择。使用它您可以简单地选择您想要保留的文本,反转选择并删除

似乎在当前版本中已删除。如何执行相同的操作?

解决方法

虽然Selection > invert selection 菜单在ST4 中被移除,但它仍然可以通过命令invert_selection 使用。因此,可以通过将该命令绑定到某个组合键来使用它。这是我的设置:

我使用了 ctrl+i 和 ctrl+s 多个组合键,实际上更容易记住。 (invert selection) 因此,如果您使用 Windows,请按 ctrl+shift+P 转到 Key Bindings,然后键入 Key Bindings。您将在新的 sublime 文本窗口中打开您的键绑定窗口,在右侧的窗格(用户定义的键绑定)中,您可以插入以下内容: 确保将其插入父花括号

{
    {..some other key bindings..},{ "keys": ["ctrl+i","ctrl+s"],"command": "invert_selection" }
}