Upper and Lower Case Commands

Is there a difference between W , E , B and W , E and B ?

In vim adventures, you take the uppercase letter B to skip the rock in the exclamation mark, i.e.

  Remember: 
 wordsXare
 not WORDSX! 

The two β€œXs” represent a treasure chest and rock, respectively. To skip a stone, you need to use uppercase B , not lowercase B. Then in usr_03.txt, section 03.1, he talks about commands for moving uppercase words.

  It is also possible to move by white-space separated WORDs.  This is not a
 word in the normal sense, that why the uppercase is used.  The commands for
 moving by WORDs are also uppercase, as this figure shows:

            ge bwe
            <- <- ---> --->
     This is-a line, with special / separated / words (and some more).  ~
        <----- <----- --------------------> ----->
          gE BWE

 With this mix of lowercase and uppercase commands, you can quickly move
 forward and backward through a paragraph. 

But when I execute the command :help W , it gives me the following:

  4. Word motions word-motions

    or <S-Right> w
 w [count] words forward.  | exclusive |  motion.

    or <C-Right> W
 W [count] WORDS forward.  | exclusive |  motion. 

There seems to be no difference. I am using Vim 7.4.

+5
source share
1 answer

It basically comes down to what vi considers to be a β€œword."

Here's a snippet of text but moved using uppercase letters W, B, etc .:

enter image description here

and here the same text is moved using lowercase w, b, etc .:

enter image description here

Basically, a "WORD" is surrounded by spaces, while a "word" can be surrounded and contain certain characters, such as - or ", etc.

+16
source

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


All Articles