Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I want a shortcut to save the current file in Vim. I want to map escape+s to :w. I tried

:map <esc-s> :w 

but it doesnt work.

share|improve this question
In case you weren't aware, this will obscure a vim function. s in normal mode deletes the character under the cursor and enters insert mode. – Marty Aug 20 '11 at 3:56
You are mixing two native vim commands to do the work of another native vim command. :w is better than <Esc>s because it doesn't force you to reach for the <Esc> key. – romainl Aug 20 '11 at 7:04
Marty: Well i didnt know you could do that with s. I have mapped <C-s> to :w now. Had to tweak the terminal for that though. romainl: I have escape mapped to my caps lock so its not a problem – whistler Aug 20 '11 at 19:41
up vote 4 down vote accepted


:map <Esc>s :w

Or perhaps,

:map <Esc>s :w<CR>

<CR>, <Enter>, and <Return> are the keycodes for the return/enter key.

share|improve this answer
Thanks, it works. – whistler Aug 20 '11 at 19:36
It is the least one. :map <Esc>s :w<CR> Thank you Marty – Peter Feb 6 '13 at 8:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.