In my case the move-right button is ;
I want Ctrl; to move the cursor 7 characters to the right. I've tried the below .vimrc mapping, but it doesn't work:
nmap <c-;> 7;
In my case the move-right button is ;
I want Ctrl; to move the cursor 7 characters to the right. I've tried the below .vimrc mapping, but it doesn't work:
nmap <c-;> 7;
Like previous comment says, it seems that ";" cannot be in the form <C-;>
.
You can test typing Ctrl+V + key sequence.
Ctrl+V + ; gives only ;
whereas Ctrl+V + L give ^L
.
So I suppose that vim cannot recognize <C-;>
.
You have some more information on the key codes help pages:
:help keycodes
:help <C-
I am not sure, but it might be because <C-;>
does not map to an ASCII character. Only @
, A-Z
, [
, \
, ]
, ^
and _
map to ASCII characters (0 through 31 respectively) when combined with Ctrl.
EDIT
I did some searching and found this thread. In it, it is said that gvim.exe
works the way I suggest: only use valid control characters, no other. Interestingly vim.exe
works differently and you can do the mapping you want.
As others said <c-;>
can't be mapped.
The best solution is:
nmap <C-l> 7l
nmap <C-h> 7h
You can remap the regular cursor keys instead.
something like this also would work:
nmap <C-Right> 7l
nmap <C-Left> 7h
Other side example for resizing windows:
" resize horzontal split window
nmap <C-Up> <C-W>-<C-W>-
nmap <C-Down> <C-W>+<C-W>+
" resize vertical split window
nmap <C-Right> <C-W>><C-W>>
nmap <C-Left> <C-W><<C-W><