Is there any difference between W, E, B and w, e and b?
The game vim adventures has you pick up an uppercase B in order to skip over a rock on an exclamation point, i.e.:
Remember: wordsXare not WORDSX!
The two 'X's represent a treasure chest and rock respectively. In order to skip over the rock, one has to use the uppercase B rather than the lowercase b. Then in usr_03.txt, section 03.1, it talks about the uppercase word motion commands.
It is also possible to move by white-space separated WORDs. This is not a word in the normal sense, that's why the uppercase is used. The commands for moving by WORDs are also uppercase, as this figure shows: ge b w e <- <- ---> ---> This is-a line, with special/separated/words (and some more). ~ <----- <----- --------------------> -----> gE B W E With this mix of lowercase and uppercase commands, you can quickly move forward and backward through a paragraph.
But when I do the :help W
command, it gives me this:
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 doesn't seem to be any difference. I'm using Vim 7.4.
Switch case You can switch the case of the alpha character underneath your cursor in vi the tilde key ( ~ ). Doing so shifts from lowercase to uppercase and vice versa.
Visual select the text, then U for uppercase or u for lowercase. To swap all casing in a visual selection, press ~ (tilde). Without using a visual selection, gU<motion> will make the characters in motion uppercase, or use gu<motion> for lowercase.
This basically comes down to what vi considers to be a 'word'.
Here's a piece of text but navigated using uppercase W,B etc:
and here's the same text navigated using lowercase w,b etc:
Basically a 'WORD' is surrounded by whitespace whereas a 'word' can be surrounded and include certain characters such as - or ' etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With