Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
一些Surround.vim命令不';行不通_Vim_Plugins - Fatal编程技术网

一些Surround.vim命令不';行不通

一些Surround.vim命令不';行不通,vim,plugins,Vim,Plugins,刚刚安装了surround.vim插件,一些命令没有按预期工作。我举一个例子 This is a lo*ng line and I want to highlight two words ys2aw“应将上述内容更改为 This is a "long line" and I want to highlight two words 但对我来说,它变成了 This is a g and I want to highlight two words 其他时候它根本没有影响!我认为这与被拉入登记册的

刚刚安装了surround.vim插件,一些命令没有按预期工作。我举一个例子

This is a lo*ng line and I want to highlight two words
ys2aw“
应将上述内容更改为

This is a "long line" and I want to highlight two words
但对我来说,它变成了

This is a g and I want to highlight two words
其他时候它根本没有影响!我认为这与被拉入登记册的内容有关

当我输入
ys
时,在右下角我可以看到它很快变为
g@

最后,我非常确定没有其他插件会像发出
verbosemapss
命令那样进行干扰:

 n  yss           <Plug>Yssurround
    Last set from ~/.vim/plugin/surround.vim                                                                                                                     
 n  ys            <Plug>Ysurround
    Last set from ~/.vim/plugin/surround.vim
nyss
最后一组来自~/.vim/plugin/surround.vim
n YSYSuround
最后一组来自~/.vim/plugin/surround.vim

有人知道这里出了什么问题吗?

我找到了答案,为了更容易在vim和其他东西之间复制/粘贴,我在
.vimrc
文件中有以下规则:

set clipboard=unnamedplus
这使得
surround.vim
的行为不正确。相反,我所做的是在
.vimrc
文件中添加以下行,以允许我打开/关闭所需的行为

nnoremap <leader>hf :set clipboard=unnamedplus<CR>
nnoremap <leader>fh :set clipboard-=unnamedplus<CR>
nnoremap hf:set clipboard=unnamedplus
nnoremap fh:设置剪贴板-=未命名加号

现在
surround.vim
正常工作

对不起,我不能重现这个bug。你的光标具体在哪里?在
o
上还是在
n
上?@romainl我只是在“o”上再试一次。如果我把它拉到vim上,就在“o”上,然后发出命令
ys2aw
我得到:
这是一条“这是一条”长线“我想突出显示两个单词”和我想突出显示两个单词
@romainl如果我撤消并再次发出命令,我会得到相同的行为,但在粘贴的内部引号之前和之后都有一行新行。如果我再次撤消并重做,则不会出现任何更改(尽管文件被列为正在修改)@romainl我想我找到了答案,在我的vim文件中,我设置了gnome和vim使用相同的剪贴板(
set clipboard=unnameplus
)对此进行注释可以消除问题,因此我猜surround以某种方式使用了未命名的寄存器。废话!我非常抱歉:我很久以前遇到过类似的问题,并且完全按照这种方式解决了。我应该记得。请将此报告给插件的作者(即打开GitHub问题);许多插件临时重置“剪贴板”,以避免此类干扰。