一些Surround.vim命令不起作用

时间:2012-10-03 19:36:35

标签: vim plugins

刚安装了surround.vim插件,部分命令无法按预期工作。我使用this question作为示例

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@

最后,我非常确定没有其他插件可以通过发出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

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

1 个答案:

答案 0 :(得分:1)

我想通了,为了更容易在vim之间复制/粘贴,以及其他所有内容,我在.vimrc文件中有以下规则:

set clipboard=unnamedplus

这会导致surround.vim行为不正确。相反,我所做的是将以下行添加到我的.vimrc文件中,以允许我打开/关闭所需的行为

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

现在surround.vim正常工作