简体   繁体   English

用键映射vim选项卡以自动打开NERDTree

[英]Mapping vim tab to with key to automatically open NERDTree

I have made a key mapping for Vim's tab functionality as 我已经为Vim的选项卡功能做了一个键映射,如下所示:

318 map <C-h> : tabprevious<CR>$
319 map <C-l> : tabnext<CR>$
320 map <C-t> : tabnew<CR> <Esc>:NERDTree<CR>$ 

but it does not seem to work . 但它似乎不起作用。 Any idea ? 任何想法 ?

I'm not sure what the leading numbers and trailing $ are for. 我不确定前导数字和尾随$是什么。

Try these: 试试这些:

nnomap <C-h> :tabprevious<CR>
nnomap <C-l> :tabnext<CR>
nnomap <C-t> :tabnew<CR>:NERDTree<CR>

All characters in the mapping are treated literally (as if you typed them). 映射中的所有字符均按字面意义处理(就像您键入它们一样)。 Note that the noremap versions are safer because they are nonrecursive, although it makes no difference in this case. 请注意, noremap版本更安全,因为它们是非递归的,尽管在这种情况下没有区别。 Also, nnoremap is restricted to normal mode, which makes sense for these mappings (you don't want to be insert mode while you are switching between tabs). 另外, nnoremap限于普通模式,这对于这些映射是有意义的(在选项卡之间切换时,您不想成为插入模式)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM