繁体   English   中英

vscode:当 escaping 来自多个游标时,将 cursor 保留在 *last* 实例上(cmd-d)

[英]vscode: Keep the cursor on the *last* instance when escaping from multiple cursors (cmd-d)

我在 VSCode ( cmd-d / ctrl-d ) 中经常使用多个游标。

要退出多光标模式和 go 到正常的单光标模式,可以使用esc

但是,这会将 cursor 移回第一个选定的单词。 我希望 cursor 停留在最后一个选定的单词上。

是否有快捷方式/设置可以做到这一点?

例子:

L01   foobar = 42
...
L99   foobar = 99

当我从 L01 开始,在 foobar 上按ctrl-d ctrl-d再次按 ctrl-d 我在 L01 和 L99 上有多个 cursor。 esc之后,我将在 L01 上拥有单个 cursor。 我想在 L99 上有一个 cursor。

注意: 如何在 Visual Studio Code 中导航回最后一个 cursor position? 在我的情况下没有帮助(它不适用于多个游标)

使用扩展Select 通过 v1.3.1和命令moveby.calculation ,您可以计算 cursor 的新位置。 通过使用 VSC 的折叠功能,您将得到 1 个 cursor。

定义此键绑定

  {
    "key": "ctrl+i escape",
    "when": "editorTextFocus",
    "command": "moveby.calculation",
    "args": {
      "lineNrEx": "selections[selections.length-1].start.line",
      "charNrEx": "selections[selections.length-1].start.character"
    }
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM