Dan Arad
Dan Arad

Reputation: 261

Is there a way to use cursorWordPart*Select command w/o capturing underscore?

I'm a fan of sub-word captures, but I'm used to the sublime way where if you have a word with underscores, it will exclude the underscore from the capture like this:

Sublime example

In VScode, I setup my keyboard shortcuts to use the cursorWordPartLeftSelect and cursorWordPartRightSelect, but they include the underscore like this:

VScode example

Here are the lines from my config:

VScode config

Is there a way to change that?

Upvotes: 9

Views: 1475

Answers (2)

Tristan McDonald
Tristan McDonald

Reputation: 141

I'm experimenting with this extension, and removing underscores and hyphens from VS Code's word separators: https://github.com/mlewand/vscode-select-part-of-word

Haven't had the time to dig into it and configure it to match Sublime Text yet but I'm praying this will be a part of the puzzle in getting VS Code to work like Sublime Text did!

Upvotes: 0

Mark
Mark

Reputation: 181639

Add the underscore character to the Editor: Word Separators list in the settings (just search for separators).

~!@#$%^&*()-=+[{]}\|;:'",.<>/?_ // with the underscore added at the end

I am a little surprised it isn't already there but it isn't. Then your WordPart selectors won't include the underscores.


It looks like v1.44 adds a fix to this so that the cursorwordpartleft/right acts like Sublime Text with respect to underscores. See https://github.com/microsoft/vscode/issues/93239.

Upvotes: 11

Related Questions