1

Here is the relevant piece of vimscript:

inoremap <c-i> <i></i><esc>F<i

I added this to ~/.vim/ftplugin/html.vim to make writing in italics easier. For some reason, whenever I'm in insert mode (even in a non-html file), and I press the tab key, I get <i></i> in my text. Any idea what could be wrong?

Amadan
  • 191,408
  • 23
  • 240
  • 301
user295106
  • 11
  • 1

2 Answers2

1

First off, you should be using inoremap <buffer> <c-i>... if you don't intend to infect non-HTML files.

Secondly, Ctrl-I and Tab are equivalent. AFAIK you can't map one without affecting the other. You might want to select a different mapping. See this question for more details.

Community
  • 1
  • 1
Amadan
  • 191,408
  • 23
  • 240
  • 301
0

Due to the way that the keyboard input is handled internally, you cannot map <Tab> / <C-I> separately, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim release.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324