Vim is very customizable. You can adjust key-bindings to your liking.
For example, if you want to save a file, you’ll type :w
or :up
in command mode.
But maybe you’re used to press CTRL+S
to save a file?
You could add a custom key-mapping to your configuration file (~/.vimrc
or similar):
nnoremap <silent><c-s> :<c-u>update<cr>
The command works in normal mode.
You can also bind CRL+S
for other modes (visual mode and insert mode):
vnoremap <silent><c-s> <c-c>:update<cr>gv
inoremap <silent><c-s> <c-o>:update<cr>
The gv
in the key-binding for visual mode preserves your visual selection.
You must disable how your terminal interprets CTRL+S
. For example, I added the following line to my ~/.bashrc
:
stty -ixon