Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
禁用另一个nmap的vim nmap_Vim_Keymapping - Fatal编程技术网

禁用另一个nmap的vim nmap

禁用另一个nmap的vim nmap,vim,keymapping,Vim,Keymapping,在我的.vimrc中,我有这些行 nmap :s :update<cr> nmap <F5> :set number!<cr> nmap:s:update 设定号码! 没有前一个映射,后一个就可以工作,否则就不行。为什么会出现这种情况?问题在于,第二个映射以一种方式开始,即:set中的:s,该方式触发了上一个映射 通常,您应该使用非递归映射,除非您有理由使用递归映射 在这种情况下,您必须使用 nnoremap :s :update<cr> nn

在我的.vimrc中,我有这些行

nmap :s :update<cr>
nmap <F5> :set number!<cr>
nmap:s:update
设定号码!

没有前一个映射,后一个就可以工作,否则就不行。为什么会出现这种情况?

问题在于,第二个映射以一种方式开始,即
:set
中的
:s
,该方式触发了上一个映射

通常,您应该使用非递归映射,除非您有理由使用递归映射

在这种情况下,您必须使用

nnoremap :s :update<cr>
nnoremap <F5> :set number!<cr>
nnoremap:s:更新
nnoremap:设置编号!
更多信息请访问