Boundary sensitive Ctrl+D in Sublime Text 3(window

2019-05-23 01:46发布

问题:

I have same requirement with maček

I borrow maček's example here:

my code pic1:

I select the first instance of es and see this (using cursor select)

pic2:

Perfect! However, when I tap ctrl + D a couple times, it will end up selecting this

pic3:

The answer from Taylan says

If you put your cursor (caret) on the word but not select it and then press Cmd + d it is going to select like in 2nd image.

Quite confusing. In windows, there is always a input cursor(a flashing vertical line, maybe call as caret) in sublime, Without selecting any thing type ctrl + D would select the char nearby the input cursor. Can't not get the result as pic2

回答1:

The following is from Sublime Text 3 (Build 3095) on Windows 7. The behavior is exactly the same on OS X and Linux, and on other builds.

First, we enter the text and place the cursor anywhere by the first word in the string, es:

test 'es cookie set on .test' do
#    ^^^ anywhere here

It can be before the e, between the e and the s, or after the s - it doesn't matter.

Next, without double-clicking, hit CtrlD, which selects es and highlights the other instances of the word.

Now, hit CtrlD twice more, and only the individual instances of es will be selected, not those that are contained within other words, such as test:


Now, if you were to double-click or otherwise select the first instance of es and hit CtrlD several times, this would be the result:

Every instance of es will be selected, even when within another word such as test or cookies.

What I've described is the default behavior of Sublime Text on all platforms, including Windows. If you put your cursor in a word and hit CtrlD, the whole word should be selected. If that does not happen, then somehow the key binding has been changed, either by a plugin or in your user keybindings file.