Fork me on GitHub


[Vim] Map Ctrl+S to save file

Beacuse pressing Ctrl-S in terminal will performs an 'XOFF' which stops commands from being receiv

ed. (If Ctrl-S freezes your terminal, type Ctrl-Q to get it going again.)

So, we need to disable that first, put below command in .bashrc

stty stop undef

Then, in the vimrc, add below lines

noremap <silent> <C-S>          :update<CR>
vnoremap <silent> <C-S>         <C-C>:update<CR>
inoremap <silent> <C-S>         <C-O>:update<CR>

It's done. The Ctrl+S has been mapped to :w


  1. In vim how to map “save” to ctrl-s
  2. How to map Ctrl+S in vim on gnome-terminal?

-- EOF --

No comments:

Post a Comment