The Computer Oracle

What does capital W do in VIM?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 What Does Capital W Do In Vim?
00:20 Accepted Answer Score 17
00:37 Answer 2 Score 6
01:17 Answer 3 Score 5
01:42 Answer 4 Score 0
01:58 Answer 5 Score 0
02:17 Thank you

--

Full question
https://superuser.com/questions/145556/w...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#vim

#avk47



ACCEPTED ANSWER

Score 17


As others have said, :W isn't defined in vanilla vim (7.0 here), so it sounds like some plugin you've installed has added it.

:command W will tell you what it does.




ANSWER 2

Score 6


I guess you have a common mapping for :W in your .vimrc to save the file as typing :w does. Often people press too long the shift key for the colon and make the typo but actually wanting to type :w. You've possibly got this mapping by copy and paste of snippets into your vimrc or by using a pre-configured vim setup such as spf13-vim distribution.

.vimrc:

command! W  write

However, as pointed out by Sam Stokes checking the meaning of commands via

:command W

and for keycombos:

:verbose map < C-j>

is a general approach to find out what a command or keycombo does.




ANSWER 3

Score 5


You can test this line

{Cursor}It's the test
  • {Cursor}: Cursor position in normal mode
  • w: will move word which separated by " ,./?"
    • You will end up at 's …
  • W: will move word which separated by " " only
    • You will end up at the …



ANSWER 4

Score 0


That's strange. The normal mapping of "W" advances by a WORD, where WORD is defined by a sequence of non-blank characters.




ANSWER 5

Score 0


:W doesn't do anything in my copy of VIM (6.4), for what that's worth. What does :help :W tell you? (For me, it just takes me to the help for :w, which wouldn't be, um, help-ful for you. :-) )