[英]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.