简体   繁体   English

一些Surround.vim命令不起作用

[英]Some Surround.vim commands don't work

Just installed the surround.vim plugin and some of the commands don't work as expected. 刚安装了Surround.vim插件,某些命令无法按预期运行。 I am using this question as an example 我以这个问题为例

This is a lo*ng line and I want to highlight two words

a ys2aw" should change the above to ys2aw"应将以上内容更改为

This is a "long line" and I want to highlight two words

but for me it changes it to 但对我来说,它变成

This is a g and I want to highlight two words

Other times it has no affect at all! 其他时候根本没有任何影响! I think it has to do with what is in the yanked register. 我认为这与暂存器中的内容有关。

When I am typing ys , in the bottom right I can see that it quickly changes to g@ 输入ys ,在右下角可以看到它迅速变为g@

Finally, I am pretty sure no other plugins are interfering as by issuing the verbose map yss command: 最后,我很确定没有其他插件会干扰,就像发出verbose map yss命令一样:

 n  yss           <Plug>Yssurround
    Last set from ~/.vim/plugin/surround.vim                                                                                                                     
 n  ys            <Plug>Ysurround
    Last set from ~/.vim/plugin/surround.vim

Does anyone know what is going wrong here? 有人知道这里出了什么问题吗?

I figured it out, to make it easier to copy/paste between vim and, well, everything else, I had the following rule in my .vimrc file: 我弄清楚了,为了更轻松地在vim之间复制/粘贴,以及其他所有内容,我在.vimrc文件中有以下规则:

set clipboard=unnamedplus

This makes surround.vim behave incorrectly. 这会使surround.vim行为不正确。 Instead what I did was add the following line to my .vimrc file to allow me to toggle this desired behaviour on/off 相反,我所做的是.vimrc添加到我的.vimrc文件中,以允许我打开/关闭此期望的行为。

nnoremap <leader>hf :set clipboard=unnamedplus<CR>
nnoremap <leader>fh :set clipboard-=unnamedplus<CR>

and now surround.vim works as normal 现在surround.vim可以正常工作

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

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