Visual Studio Code 环绕

2024-01-10

我找不到任何方法可以在 VS Code 中用某些内容包围所选内容。

For example doing something like that : text => "text" just by selecting the word text and typing key "

另一个带有以下文本的示例:

mon
tue
wed
thu
fri
sat
sun

通过选择所有这些单词:

mon|
tue|
wed|
thu|
fri|
sat|
sun|

and typing " I would like to perform something like this :

"mon"
"tue"
"wed"
"thu"
"fri"
"sat"
"sun"

Selecting some text and pressing " already works in VSCode to surround a single item, and works for multi-line selections as well.

NOTE: this is language dependent. The language syntax must define opening and closing braces, e.g. quotes, braces, etc. So this will not work in a "plaintext" file, for example. Change your language mode with CTRL+SHIFT+P and type Change Language Mode ENTER and select something like JavaScript where this is supported.

但你所追求的并不是那么有效。最好的选择是使用多光标。

Place the cursor at the start of the first line, press CTRL+ALT+DOWN to add another cursor below on the next line. Keep doing that until you have a cursor in front of all your words.

Then just type " then END then " and all your lines are surrounded by quotes.

NB: To check if you have a key bound, and what it is, you can always press CTRL+SHIFT+P and type Add Cursor Below and if there's a keybinding it will show to the right of that text.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Visual Studio Code 环绕 的相关文章

随机推荐