Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

migrated from stackoverflow.com May 26 '10 at 15:56

This question came from our site for professional and enthusiast programmers.

1  
in my vim it gives me "E492: Not an editor command: W" if i try to ":W". – akira May 26 '10 at 16:10
up vote 8 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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

share|improve this answer
1  
@bentsai: OP is not in control-mode but in ex-mode, as in "instead of :w he uses :W" – akira May 26 '10 at 15:59
    
@akira that makes more sense. – bentsai May 26 '10 at 16:00

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .