Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: Remove mapping created by vim-plugin

I use the Vimwiki-Plugin a lot, but remapping <Backspace> and <CR> is just anoying. If I use :nmap, the mapping is shown:

n  <CR>              @<Plug>VimwikiFollowLink
n  <Backspace>       @<Plug>VimwikiGoBackLink

If I try to remove tha mapping with :nunmap <CR> I get an "E31: No such mapping" error. Is there a way to give <CR> and <Backspace> its's normal behaviour back?

like image 293
f00860 Avatar asked Apr 17 '13 12:04

f00860


1 Answers

if you want to just disable it, you could give

:nunmap <buffer> <CR>

because it is a buffer-local mapping.

or

:h vimwiki_<cr>

you found:

<CR>                    Follow/create wiki link (create target wiki page if
                        needed).
                        Maps to |:VimwikiFollowLink|.
                        To remap: >
                        :nmap <Leader>wf <Plug>VimwikiFollowLink

if you remap that to another key, e.g. the keys in example <leader>wf, the <cr> would be reset to normal.

because in its code, vimwiki has:

if !hasmapto('<Plug>VimwikiFollowLink')
  nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink
endif

same for the <BS>

like image 108
Kent Avatar answered Nov 04 '22 06:11

Kent