简体   繁体   English

“ cs”命令在vim中起什么作用,为什么我不能将其映射为做其他事情?

[英]What does 'cs' command do in vim and why is it that I can't map it to do other things?

I have the ConqueTerm plugin installed in my vim so that I can run bash commands without leaving my editing environment. 我在vim中安装了ConqueTerm插件,这样我可以运行bash命令而无需离开编辑环境。 It's cool when you can run Python scripts while seeing you code within the same screen. 当您可以在同一屏幕上看到代码的同时运行Python脚本时,这很酷。

I wanted to be more convenient to toggle ConqueTerm, so I added these two lines in my .vimrc 我想更方便地切换ConqueTerm,所以我在.vimrc添加了这两行

" quick access to ConqueTerm
nnoremap cv :ConqueTermVSplit bash<CR>
nnoremap cs :ConqueTermSplit bash<CR>

I have experimented these two commands before so that I can be sure I won't overwrite existing commands. 我之前已经尝试过这两个命令,以确保可以覆盖现有命令。 ' cv ' does absolutely nothing since after I typed these two characters in normal mode, they appear in the bottom-right corner of my vim window, still listening for my next stroke. ' cv '绝对不做任何事情,因为在正常模式下键入这两个字符后,它们出现在我的vim窗口的右下角,仍在听我的下一个笔画。 But ' cs ' is a different story, since the letters don't appear where ' cv ' would, and my cursor would move to the status area, where we run commands such as ' :wqa! 但是“ cs ”是另一回事,因为字母不会出现在“ cv ”所在的位置,并且我的光标将移至状态区域,在此运行“ :wqa! ', only I can't do anything there. ',只有我在那里什么也不能做。 Whatever key I press I go back to the editing area. 无论我按什么键,我都会返回到编辑区域。 And after I edited my .vimrc , my ' cv ' works like a charm whereas my ' cs ' still does the same thing I don't understand. 在我编辑.vimrc ,我的' cv '就像一个.vimrc ,而我的' cs '仍然做我不了解的事情。

So, as the title says, what exactly does ' cs ' do, and why I failed to map it to other command? 因此,正如标题所示,“ cs ”到底是做什么的,为什么我无法将其映射到其他命令? Thanks! 谢谢!

You can issue :map cs to see what it maps to. 您可以发出:map cs来查看它所映射的内容。

cs is not mapped by default in Vim, but I have a hunch you have installed the plugin called surround . cs默认情况下不会在Vim的映射,但是我中有你已经安装了被称为插件预感环绕 That reserves normal mode bindings cs , ds and a couple others. 保留普通模式绑定csds和其他几个绑定。 Check the link for behaviour. 检查链接的行为。

使用:verbose map cs打印出cs绑定到的内容。

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

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