我想将%
重新映射到v%
以选择匹配大括号(括号等)中的文本,但我只能在vim内部而不是.vimrc
中进行。
我可以在vim中这样做:
noremap % v%
或
nnoremap % v%
(我真的不知道区别,但目的是仅在正常模式下更改映射)
但是当我在.vimrc
中这样做时,我没有达到预期的效果
我的:noremap
î *@:call AutoPairsJump()<CR>
ð *@:call AutoPairsToggle()<CR>
n <C-L> * :nohlsearch<CR><C-L>
o % * v:<C-U>call <SNR>15_Match_wrapper('',1,'o') <CR>
v % * :<C-U>call <SNR>15_Match_wrapper('',1,'v') <CR>m'gv``
n % * :<C-U>call <SNR>15_Match_wrapper('',1,'n') <CR>
Q <Nop>
n R * R<C-R>=<SNR>19_feedPopup()<CR>
x S <Plug>VSurround
o [% * v:<C-U>call <SNR>15_MultiMatch("bW", "o") <CR>
v [% <Esc>[%m'gv``
n [% * :<C-U>call <SNR>15_MultiMatch("bW", "n") <CR>
o ]% * v:<C-U>call <SNR>15_MultiMatch("W", "o") <CR>
v ]% <Esc>]%m'gv``
n ]% * :<C-U>call <SNR>15_MultiMatch("W", "n") <CR>
n a * a<C-R>=<SNR>19_feedPopup()<CR>
v a% <Esc>[%v]%
n cs <Plug>Csurround
n ds <Plug>Dsurround
n gx <Plug>NetrwBrowseX
x gS <Plug>VgSurround
o g% * v:<C-U>call <SNR>15_Match_wrapper('',0,'o') <CR>
v g% * :<C-U>call <SNR>15_Match_wrapper('',0,'v') <CR>m'gv``
n g% * :<C-U>call <SNR>15_Match_wrapper('',0,'n') <CR>
n i * i<C-R>=<SNR>19_feedPopup()<CR>
n ySS <Plug>YSsurround
n ySs <Plug>YSsurround
n yss <Plug>Yssurround
n yS <Plug>YSurround
n ys <Plug>Ysurround
n <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>
v <Plug>VgSurround * :<C-U>call <SNR>16_opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1)<CR>
v <Plug>VSurround * :<C-U>call <SNR>16_opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR>
n <Plug>YSurround * :<C-U>set opfunc=<SNR>16_opfunc2<CR>g@
n <Plug>Ysurround * :<C-U>set opfunc=<SNR>16_opfunc<CR>g@
n <Plug>YSsurround * :<C-U>call <SNR>16_opfunc2(v:count1)<CR>
n <Plug>Yssurround * :<C-U>call <SNR>16_opfunc(v:count1)<CR>
n <Plug>Csurround * :<C-U>call <SNR>16_changesurround()<CR>
n <Plug>Dsurround * :<C-U>call <SNR>16_dosurround(<SNR>16_inputtarget())<CR>
n <Plug>SurroundRepeat * .
我的.vimrc
http://pastebin.com/qhUYzS9W
答案 0 :(得分:3)
此行告诉它:
n % * :<C-U>call <SNR>15_Match_wrapper('',1,'n') <CR>
matchit.vim 插件会覆盖您的映射。 (:verbose nmap %
也会告诉你的。)
由于插件不提供替代<Plug>
映射,因此它是 - 或者:保留映射(并删除插件脚本并扩展匹配),或者为映射选择另一个键。