Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim mapping ctrl-;

Tags:

vim

mapping

ctrl

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 image 782
john-jones Avatar asked Jun 23 '10 11:06

john-jones


2 Answers

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-
like image 60
Drasill Avatar answered Oct 26 '22 03:10

Drasill


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.

like image 34
heijp06 Avatar answered Oct 26 '22 03:10

heijp06