When typing <Enter> in normal mode in Vim with the Tagbar plugin installed, the Tagbar window is opened automatically. I want to disable this functionality. What must I do?
Your mapping for <C-m>
is actually the cause of the Enter key opening Tagbar. If you remove that map from your vimrc, the enter key will no longer trigger :TagbarToggle
.
Mappings for <C-m>
and <CR>
(Enter) are synonymous in Vim:
The following table shows the mapping between some of the keys on the keyboard and the equivalent Ctrl-key combination:
Ctrl-I Tab
Ctrl-[ Esc
Ctrl-M Enter
Ctrl-H BackspaceIf you use one of the Ctrl-key combination in the above table in a map, the map also applies to the corresponding key. Both the keys produce the same key scan code. For example, if you create a map for CTRL-I, then you can invoke the map by pressing Ctrl-I or the Tab key.
This means when you set nmap <C-m> :TagbarToggle<CR>
, it is the same as
also setting nmap <CR> :TagbarToggle<CR>
.
You'll probably want to choose a new key instead of M. The alternative is to
change the key code sent by <C-m>
at the operating system level with some
remapping program.
The terminal key bindings come from readline, the program that processes input text in your terminal prompt. A full list of key bindings is in the readline manual.
You can find more info about Vim key codes by typing :help keycodes
in Vim, or reading the help docs here.