You could write a mapping in the .vimrc, but I don't know if that is what you should. Do you only want to map the c
command, or the behavior of all copy/paste commands. Because a normal installation of Vim will not use the clipboard and you most likely have a setting in the .vimrc that tells Vim to use the clipboard at default. Normally the unnamed register ""
(which is " the unnamed one) will be used.
What about an alternative c
command, without changing the normal behavior? In example this mapping in .vimrc:
nnoremap <leader>x "ac
nnoremap <leader>c "ay
nnoremap <leader>v "ap
The default leader-key is backslash. Now in Normal mode when you type \xw
it will cut the word into register a
. \v
will paste from register a
. You can remap the leader key to something else, in example the spacebar (like I do).
" Leader key space
let mapleader=" "
" Make sure spacebar does not have any mapping beforehand.
nnoremap <silent> <space> <nop>
I don't recommend to change the default behaviour of c
, that is why I recommend to use it with leader key.