Vim:删除vim-plugin创建的映射

Fu8*_*u86 12 mapping vim plugins

我经常使用Vimwiki-Plugin,但是重新映射<Backspace>并且<CR>只是很烦人.如果我使用:nmap,则显示映射:

n  <CR>              @<Plug>VimwikiFollowLink
n  <Backspace>       @<Plug>VimwikiGoBackLink
Run Code Online (Sandbox Code Playgroud)

如果我尝试删除tha映射,:nunmap <CR>我得到一个"E31:没有这样的映射"错误.有没有办法让<CR><Backspace>它的正常行为了?

Ken*_*ent 21

如果你想要禁用它,你可以给

:nunmap <buffer> <CR>
Run Code Online (Sandbox Code Playgroud)

因为它是缓冲区本地映射.

要么

:h vimwiki_<cr>
Run Code Online (Sandbox Code Playgroud)

你发现了:

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

如果将其重新映射到另一个密钥,例如示例中的密钥<leader>wf,<cr>则将重置为正常.

因为在其代码中,vimwiki具有:

if !hasmapto('<Plug>VimwikiFollowLink')
  nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink
endif
Run Code Online (Sandbox Code Playgroud)

同样的 <BS>

  • 如果你想摆脱映射,我会建议像`nmap <Plug> NoVimwikiFollowLink <Plug> VimwikiFollowLink`这样的东西. (2认同)