2

I want to remap <C-I> to print markdown * symbol around the previous word. For example:

# user actions inside <...>
some text typed in vim insert mode<cursor_position> <C-I>

# expected  vim output
some text typed in vim insert *mode*<cursor_position>

I am using the following line in my .vimrc for remapping

inoremap <C-i> <ESC>Bi*<ESC>ea*

Problem is, as per help :h i_CTRL-I, <C-I> in insert mode is already mapped to something and the mapping above doesn't work for me. Pressing <C-I> in insert mode leaves a <TAB> on editor.

<Tab> or CTRL-I Insert a tab. If the 'expandtab' option is on, the equivalent number of spaces is inserted (use CTRL-V to avoid the expansion; use CTRL-Q <Tab> if CTRL-V is mapped i_CTRL-Q). See also the 'smarttab' option and ins-expandtab.

  1. How do I make insert mode <C-I> mapping work?
  2. How can I override global vim key-mapping with my own key-mapping defined in .vimrc file?
  • 1
    Very similar which explains some context: Disable <Esc> but keep <C-[>. The short version is that Tab is ctrl+i. Perhaps there are workarounds specific for Tab, so not quite a duplicate. – Martin Tournoij May 6 '18 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.