Shortcuts: Ctrl q to exit vim

I really like this tip to exit vim quickly.

You can use ZZ to save and exit vim but it’s 3 keystrokes. This neat hack lets you do the same in just 2 keystrokes. On the Mac:

~/.bash_profile

bind -r '\C-s'
stty -ixon

~/.vimrc

inoremap <C-s> <esc>:w<cr>                 " save files
nnoremap <C-s> :w<cr>
inoremap <C-d> <esc>:wq!<cr>               " save and exit
nnoremap <C-d> :wq!<cr>
inoremap <C-q> <esc>:qa!<cr>               " quit discarding changes
nnoremap <C-q> :qa!<cr>

https://unix.stackexchange.com/a/241784/198669

https://unix.stackexchange.com/a/241784/198669

https://unix.stackexchange.com/a/241784/198669

Leave a Reply

Your email address will not be published. Required fields are marked *