On Sat, April 2, 2011 6:14 am, Jean-Rene David wrote: > * wei gao [2011.04.01 02:40]: >> I want to add ";" to the end of line when coding. So, I add the >> following >> map in vimrc. however, it's not working for me (if I change to <C-e>, >> it's >> OK). Anybody know why? <C-;> is mapped to a special command already? >> >> :inoremap <C-;> <C-o>A; > > While you may see things like <C-e> or <C-]> as a sequence of keys, vim > actually gets those as a single character. These characters are *typed* > using a combination of the control key and another key on your keyboard > but when they actually reach vim they are one character. > > The set of these so called "control characters" are the first 32 ASCII > values (namely 0x00 to 0x1F in hex). You can map each control character > (which are "unprintable" characters) to a printable character used to > enter it on the keyboard. You do this by adding 0x40 to the value of the > control character like this: > > 0x00 = <C-@> maps to 0x40 = @ > 0x01 = <C-A> maps to 0x41 = A > 0x02 = <C-B> maps to 0x42 = B > 0x03 = <C-C> maps to 0x43 = C > ... > 0x1A = <C-Z> maps to 0x5A = Z > 0x1B = <C-[> maps to 0x5B = [ > 0x1C = <C-\> maps to 0x5C = \ > 0x1D = <C-]> maps to 0x5D = ] > 0x1E = <C-^> maps to 0x5E = ^ > 0x1F = <C-_> maps to 0x5F = _ > > And that's it. There are no others. > > So, long story short, the reason you can't map <C-;> is that there is no > such character.
For the record, this is also covered briefly in the FAQ: http://vimhelp.appspot.com/vim_faq.txt.html#faq-20.5 regards, Christian -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
