配置
- Windows 7 Service Pack 1(64位)
- VIM 7.4(2013年8月10日),32位GUI版本
- cscope_macros.vim插件,来自www.vim.org,版本2.0.0
问题
该插件使用"CTRL空格键"或<CTRL-@>
将几个cscope find函数映射到水平或垂直拆分中打开,因为根据插件文档,VIM就是这样识别它的。以下是插件的一个片段:
" Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
" makes the vim window split horizontally, with search result displayed in
" the new window.
"
" (Note: earlier versions of vim may not have the :scs command, but it
" can be simulated roughly via:
" nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
但是,"CTRL空格键"不起作用。当我看到已经映射的<C-@>
实际上被翻译为<nul>
。例如,如果我使用命令:map
,这就是cscope插件映射密钥的结果。
n <nul>d :scs find d <C-R>=expand("<cword>")<CR><CR><Tab>
n <nul>i :scs find i <C-R>=expand("<cfile>")<CR><CR><Tab>
n <nul>f :scs find f <C-R>=expand("<cfile>")<CR><CR><Tab>
n <nul>e :scs find e <C-R>=expand("<cword>")<CR><CR><Tab>
我唯一能找到"CTRL空格键"/<CTRL-@>
(:help index
)的是
tag char action in Insert mode ~
-----------------------------------------------------------------------
i_CTRL-@ CTRL-@ insert previously inserted text and stop
insert
但这不是我观察到的行为。
当我尝试在插入模式下使用"CTRL空格键"时,只会在光标处插入一个空格。当我在正常模式下使用它时,它似乎会将光标移动到下一个单词的开头,或者如果它是空白的,则移动到下行。
那么,如何在windows上的VIM中映射"CTRL空格键"?
在Windows GVIM中,使用直接的<C-Space>
作为映射的左侧。<C-@>
或等效的<Nul>
是(Linux)终端的一种变通方法,它通常提供较少的可映射密钥。这些指示大概只是针对这一点。