Tuesday, July 31, 2012

Difference between and

The help page on key-notation (:help key-notation) states that several keys are equivalent for others

- <C-H> and <BS>
- <C-I> and <Tab>
- <C-L> and <FF>

For most keys this appears to be true. Attempts to map with the LHS of <C-I> and <Tab> would conflict and the last one typed would win. For example

:imap <Tab> hit tab
:imap <C-I> hit control i
:imap

This will actually print the following.

i <Tab> hit control i

This behavior is expected. The keys are equivalent and hence the latter mapping should win out exactly as if I had typed <Tab> in the second mapping. This behavior appears to play out for 6 of the 7 equivalent key pairs listed on that page.

It doesn't play out though for <C-H> and <BS>. These appear to be different keys even though they have the same ASCII value

:imap <C-H> hit control h
:imap <BS> hit backspace
:imap

This will print both mappings out to the screen. Subsequent key strokes of <C-H> and <BS> will insert the expected value into insert mode.

Why is the <C-H> and <BS> pair different in this respect? I can't seem to find any justification for this difference?

I'm using gVim 7.2 on Windows (7 or server 2008).

--
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

No comments: