Glam Prestige Journal

Bright entertainment trends with youth appeal.

in VIM sometimes when saving, I accidentally hit capital W instead of its lowercase brother. I am prompted for my system password, so I assume it is running a sudo command of some sort, but do you know what?

Thank you!

4

5 Answers

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.

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.

You can test this line

{Cursor}It's the test

{Cursor} : Cursor position in normal mode, w: will move word which separated by " ,./?" W: will move word which separated by " " only

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

2

: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. :-) )

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy