Removed hyphen from word_separators, ctrl+d no longer makes sense

后端 未结 1 990
走了就别回头了
走了就别回头了 2020-12-19 18:13

I removed the - from the word_separators setting, and that works fine.

But ctrl + d on the word a still

相关标签:
1条回答
  • 2020-12-19 18:40

    From what I can tell from some informal experimenting while answering your other question, the "word_separators" setting seems to primarily relevant when double-clicking to select words. For example, I have the following words in a file:

    foobar

    and my word_separators list is ./\\()\"'-:,;<>~!@#%^&*|+=[]{}`~?$, so it includes - and / but not _. If I put my cursor in the first foo (without selecting the whole word first) and hit CtrlD, I get

    foobar2

    and if I continue hitting CtrlD for several more times, I get

    foobar3

    so only the "individual words" are selected - foo_bar is not, nor is foobar. However, if I set word_separators to .\\()\"':,;<>~!@#%^&*|+=[]{}`~?$ (removing - and /) I get the same results when hitting CtrlD repeatedly:

    foobar4

    - and / are still treated as word separators, even though I removed them from the list. If I add _ to the word_separators list, the results are the same, and only one obvious conclusion can be drawn: word_separators is ignored by CtrlD (find_under_expand).


    However, the word_separators list IS used when double-clicking to select a word. With the list like this: .\\()\"'_:,;<>~!@#%^&*|+=[]{}`~?$ (missing - and /, but with _), double-clicking on foo in each word in turn gives the following:

    foobar5

    foobar6

    foobar7

    foobar8

    Interestingly, double-clicking on the very first foo gives

    foobar9

    indicating that the "box" highlighting of similar selections is not paying attention to word_separators.


    When using Find -> Find... to search, word_separators is ignored. When nothing is selected and foo is entered into the search box (non-regex search), the following matches are highlighted:

    foobar10

    This is the same regardless of whether -, /, and/or / are in word_separators or not.

    If "Whole Word" is set in the options, the results are a bit different, but again they don't change regardless of whether -, /, and/or / are in word_separators:

    foobar11


    TL;DR

    So, the conclusion is that word_separators is only in effect when double-clicking to select a word. Using a Find dialog or CtrlD (find_under_expand command) relies on some internal separator list, which apparently can't be altered (see my answer here).


    A little bit more

    Some info I forgot to add earlier: word_separators is also used by some plugins for various sorts of things, such as creating/modifying/otherwise working with selections, doing programmable completions, find and replace, and other sorts of stuff.

    0 讨论(0)
提交回复
热议问题