使用不同的分离器以两种方式在单词之间导航
感谢 Visual Studio code> Visual Studio Code- customizing Word Syparators 分离器。 因此,现在每当我按 ctrl +左箭头时,VS代码都会识别该单词在下划线后立即开始。 但是,有时我想在变量/函数/班级名称的最初开始,并使用下划线作为隔板,我必须按 ctrl +左箭头几次到达那里。 是否有任何方法可以得到以下行为:
- ctrl +左箭头它将下划线视为分隔符
- ctrl ++ alt alt alt +左箭头它不认为下划线为分离器
Thanks to Visual Studio Code—Customizing word separators I was able to set underscore as separator.
So now whenever I press Ctrl+Left Arrow, VS code recognizes that the word starts right after the underscore.
However sometimes I want go at the very beginning of the variable/function/class name and, using underscore as separator, I have to press
Ctrl+Left Arrow several times to get there.
Is there any way to get a behavior like:
- Ctrl+Left Arrow it considers underscore as separator
- Ctrl+Alt+Left Arrow it doesn't consider underscore as separator
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(3)
您可以很容易地使用宏扩展“ nofollow noreferrer”> multi-command 。在
keybindings.json
中制作此键键,You can do this quite easily with the macro extension multi-command. Make this keybinding in your
keybindings.json
:正如RIOV8所说,您可以使用 by plugin。
请按照以下步骤操作以获取您想要的内容:
或至少在文件末尾插入此快捷方式,之后是','。
您应该拥有类似的东西。
文件>偏好>设置(Ctrl+,),搜索
selectby
单击
在settings.json
中编辑
替换您拥有的任何内容:
“键”:“ Ctrl+Alt+左”
和“ args”:[...,“ prev”,“ start”,“ start” ]
如果我什么都没错过,那么你应该很好:)
As rioV8 said, you can use the Select By plugin.
Follow these steps to get pretty much what you want:
Or at least insert this shortcut at the end of the file, following a ','.
You should have something like this.
In File > Preferences > Settings (Ctrl+,), search for
selectby
Click
Edit in settings.json
Replace anything you have with that:
"key": "ctrl+alt+left"
and"args": [ ..., "prev", "start" ]
If I didn't miss anything, you should be good to go :)
实现所需行为的另一种可能方法是通过以下步骤:
将
_
排除在单词分离器中,以防万一您仍然包括在内。将以下两个
键键
添加到keybindings.json
:第一个键键键允许您通过按下 ctrl + << ctrl kbd> shift + 左箭头。
第二个键界允许您通过按 ctrl + 左箭头来移动单词的左侧,但考虑
_
这次。Another possible way for achieving the desired behaviour is through the following steps:
Exclude
_
from the word separators in case you still have it included.Add the two following
keybindings
to yourkeybindings.json
:The first keybinding allows you to move to the left of a word by pressing Ctrl + Shift + Left Arrow.
The second keybinding allows you to move to the left of a word by pressing Ctrl + Left Arrow but considering
_
this time.