简体   繁体   English

vim与领导者一起使用<C-?>

[英]vim using leader together with <C-?>

I found this snippet from unite.vim 我从unite.vim找到了这个片段

nnoremap <leader>t :<C-r>Unite -no-split -buffer-name=files   -start-insert file_rec<cr>

It seems it try to map "\\t" to "Unite -no-split -buffer-name=files -start-insert file_rec" 似乎它尝试将“ \\ t”映射到“ Unite -no-split -buffer-name = files -start-insert file_rec”

what does <Cr> mean here ? <Cr>在这里是什么意思? what is the difference from the following: 与以下内容有何区别:

nnoremap <leader>t :Unite -no-split -buffer-name=files   -start-insert file_rec<cr>

In Ex mode, Ctrl + R (written <Cr> in Vim) will insert the content of the specified register on the Ex command line. Ex模式下, Ctrl + R (在Vim中写为<Cr> )将在Ex命令行上插入指定寄存器的内容。 <Cr>U will insert the content of the U register. <Cr>U将插入U寄存器的内容。 All commands starting with : are Ex mode commands. :开头的所有命令均为Ex模式命令。

To see this in action, do the following: 要查看实际效果,请执行以下操作:

  1. Delete a word using "adw . This means "delete a word to register a ". 删除使用一个词"adw ,这意味着‘删除一个字注册a ’。
  2. Enter normal mode. 进入普通模式。
  3. Type in :<Cr>a . 输入:<Cr>a Your Ex mode command line will now contain the word. 您的Ex模式命令行现在将包含单词。

I have looked at the relevant .vimrc and the unite.vim source, and I doubt the <Cr> is supposed to be there. 我已经看过相关的.vimrcunite.vim源代码,并且我怀疑<Cr>是否应该存在。 It is most likely a bug or a typo. 它很可能是错误或错字。

For more information, see :help c_CTRL-R . 有关更多信息,请参见:help c_CTRL-R

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

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