Choosing an entire word containing a dash

Say I have a line

hello how-ar[]e-you doing

where []is my cursor. How would I effectively choose how-are-youto

hello [how-are-you] doing

So far I could come up with Bvt<space>

+4
source share
2 answers

Vim has the concepts of “word” and “word”, where “word” is a sequence of characters in an option 'iskeyword', and “WORD” is a sequence of characters without spaces.

In this way,...

  • movement w("word") will move to -after are, because it is -not part 'iskeyword',
  • movement w("WORD") will move to doing,
  • iw ( " " ) are,
  • iw ( " WORD" ) how-are-you,
  • .. .

, , iw:

viW

:help navigation .

+10

( Word ), , (, - , ), vimrc

set iskeyword+="-"

viw . :h iskeyword

+6

Source: https://habr.com/ru/post/1694208/


All Articles