In Vim, how can I map "save" (:w
) to Ctrl + S?
I am trying "map" the command, but xterm freezes when I press Ctrl + X.
If I give Ctrl + V, Ctrl + S, still I see only a ^
, not ^S
.
Ctrl+S is a common command to terminals to stop updating, it was a way to slow the output so you could read it on terminals that didn't have a scrollback buffer. First find out if you can configure your xterm to pass Ctrl+S through to the application. Then these map commands will work:
noremap <silent> <C-S> :update<CR>
vnoremap <silent> <C-S> <C-C>:update<CR>
inoremap <silent> <C-S> <C-O>:update<CR>
BTW: if Ctrl+S freezes your terminal, type Ctrl+Q to get it going again.