【问题标题】:Is there a way to toggle selection in Sublime Text?有没有办法在 Sublime Text 中切换选择?
【发布时间】:2016-06-14 09:31:57
【问题描述】:

我不喜欢在移动光标时按住 shift 按钮。我正在寻找类似于 emacs 的东西,您可以在其中按 Ctrl+Space,将光标移动到您想要的位置(同时突出显示文本),然后再次按 Ctrl+Space 以完成选择。

我查看了键盘映射文件,但我唯一能找到的就是设置标记。这样做不会在我移动光标时突出显示文本,而且它还使用两个不同的键绑定来开始和结束选择。

这可以在崇高的文本中完成吗? 2还是3都无所谓。

【问题讨论】:

    标签: editor sublimetext text-editor


    【解决方案1】:

    您可以使用上下文并在 ctrl+space 上切换设置,这将导致此键绑定:

    { "keys": ["left"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["right"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["up"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["down"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["ctrl+right"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["alt+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["pageup"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["pagedown"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof", "extend": true}, "context": [{"key": "setting.do_extend"}] },
    { "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof", "extend": true}, "context": [{"key": "setting.do_extend"}] },
    
    { "keys": ["ctrl+space"], "command": "toggle_setting", "args": {"setting": "do_extend"} },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-15
      • 2015-04-04
      • 2014-10-29
      • 1970-01-01
      • 2013-06-10
      • 2021-09-21
      • 2014-05-25
      相关资源
      最近更新 更多