Wednesday, October 27, 2010

Vim - Save in Insert Mode

You can use the following combination:
  • Press Ctrl+O
  • Than enter command :w and hit enter
But there is a better way. If you come from Windows there is Ctrl+S combination that saves changes, you can use it in your VIM editor (try issue the following in Vim command mode):
" Use Ctrl+S to save file is edit and command modes
inoremap <c-s> <c-o>:w<cr>
nnoremap <c-s> :w<cr>

Consider add it to your .vimrc file. If you are using Vim in putty console, please have a look here. Read more about mapping keys here.

No comments :

Post a Comment