I have a peculiar situation where the value of a number on the nvim screen on which the cursor is sitting gets decremented by 1 when I (often accidentally) hit <C-x><C-s>
in commandline mode (I moved a few months ago after over 25 years with emacs
. So, I was wanting to map my <C-x><C-s>
to save the file in commandline mode.
I tried adding:
cnoremap <C-x><C-s> :w<cr>
to map my <C-x><C-s>
to save the file, and put this line in my .config/nvim/init.vim
but it does not seem to be making any difference in the behavior of the key combination.
What am I doing wrong. At this point, I would be fine disabling <C-x><C-s>
altogether as a last resort.
cnoremap
works in command-line mode. Did you mean to use:nnoremap
instead?:help vim-modes
or Vivian's answer.