在tmux上粘贴vim会返回这个错误:E353:在寄存器*中什么都没有。

时间:2021-02-07 19:18:09

I have Vim inside Tmux. When I copy text using yy and paste. I get the following error E353: Nothing in register *.

我在Tmux里面有Vim。当我用yy和粘贴复制文本时。我得到以下错误E353:没有注册*。

This issue only happens when using Vim 7.4. However, when using Vim outside of Tmux, this issue does not occur.

这个问题只在使用Vim 7.4时发生。但是,当在Tmux之外使用Vim时,不会出现这个问题。

On a sidenote, this does not happen when using Vim 7.3 (vim version installed by OSX 10.9), inside or outside of Tmux.

在旁注中,在使用Vim 7.3(由OSX 10.9安装的Vim版本)、Tmux内部或外部时不会发生这种情况。

In .vimrc, I have:

在. vimrc,我:

set clipboard=unnamed

In .tmux.conf, I have:

在.tmux。相依,我:

set-option -g default-command "reattach-to-user-namespace -l bash"

5 个解决方案

#1


8  

In my case I just got it fixed by including on .tmux.conf the following configuration:

在我的情况下,我只是通过在。tmux上添加。参看以下配置:

set -g default-command 'reattach-to-user-namespace $SHELL --login'

#2


4  

Try "*y and "*p.

尝试“* y”* p。

If you do that often, put the line below in your ~/.vimrc to synchronize your system clipboard and Vim's unnamed register:

如果你经常这样做,在你的~/中写上下面的行。vimrc同步您的系统剪贴板和Vim的未命名寄存器:

set clipboard=unnamed

See :help registers and :help 'clipboard.

参见:帮助注册和:帮助剪贴板。

#3


0  

Edit: Actually it seems to only when I start vim on a nerdtrw buffer using vim .. Setting again the clipboard to unnamed seems to fix the issue (:set clipboard=unnamed).

编辑:实际上,似乎只有当我使用vim在nerdtrw缓冲区开始vim时。再次将剪贴板设置为无名(:设置剪贴板=无名)似乎可以修复问题。

I experienced the same issue. It seems to be a bug in the latest vim versions available via brew (7.4.430 and 7.4.430_1).

我也遇到过同样的问题。在最新的通过brew(7.4.430和7.4.430_1)提供的vim版本中,这似乎是一个bug。

I did not find any workaround and had to rollback to the previous one that is working fine (7.4.335).

我没有找到任何变通方法,不得不回滚到以前的工作(7.4.335)。

To do so:

这样做:

brew rm vim
brew update
cd /usr/local
git checkout 2150e2d2a89f79f3ab58490433e91f7a36ebf150
brew intall vim
git checkout master
brew cleanup

If you get a 404 when trying to download vim, edit the formula file in /usr/local/Library/Formula/vim.rb and replace:

如果在尝试下载vim时得到404,请在/usr/ local/library/formula /vim中编辑公式文件rb和替换:

by

通过

#4


0  

I face the same issue, E353: Nothing in register * using Ubuntu 14.04 which has vim version: 2:7.4.052-1ubuntu3 installed from its default PPA repository.

我面临着同样的问题,E353:使用Ubuntu 14.04没有注册*,它有vim版本:2:7.4.052-1ubuntu3,安装在默认的PPA存储库中。

Was working OK with vim version : 7.3

使用vim版本7.3是否可以工作

Work around : You can use below options :

变通:您可以使用以下选项:

  1. Use vim -p to open multiple panes. Eg: vim -p file1 file2 and copy and paste as necessary. To move between panes, you can use ":tabn" or ":tabp"
  2. 使用vim -p打开多个窗格。例如:vim -p file1 file2,并根据需要复制和粘贴。要在窗格之间移动,可以使用“:tabn”或“:tabp”
  3. If using Nerdtree plugin with your vim, then also you can simply yank and navigate to the destination file and do a paste.
  4. 如果在vim中使用Nerdtree插件,那么您也可以简单地拖拽并导航到目标文件并进行粘贴。

#5


0  

I've tried in many ways, I can get from the Internet to solve this problem, But finally, the solution is removing your configuration "set clipboard=uname" in your vimrc. I'm trying to find why it works...

我已经尝试了很多方法,我可以从Internet上获得解决这个问题的方法,但是最后,解决方案是删除vimrc中的“set clipboard=uname”配置。我想找出它为什么有效……

#1


8  

In my case I just got it fixed by including on .tmux.conf the following configuration:

在我的情况下,我只是通过在。tmux上添加。参看以下配置:

set -g default-command 'reattach-to-user-namespace $SHELL --login'

#2


4  

Try "*y and "*p.

尝试“* y”* p。

If you do that often, put the line below in your ~/.vimrc to synchronize your system clipboard and Vim's unnamed register:

如果你经常这样做,在你的~/中写上下面的行。vimrc同步您的系统剪贴板和Vim的未命名寄存器:

set clipboard=unnamed

See :help registers and :help 'clipboard.

参见:帮助注册和:帮助剪贴板。

#3


0  

Edit: Actually it seems to only when I start vim on a nerdtrw buffer using vim .. Setting again the clipboard to unnamed seems to fix the issue (:set clipboard=unnamed).

编辑:实际上,似乎只有当我使用vim在nerdtrw缓冲区开始vim时。再次将剪贴板设置为无名(:设置剪贴板=无名)似乎可以修复问题。

I experienced the same issue. It seems to be a bug in the latest vim versions available via brew (7.4.430 and 7.4.430_1).

我也遇到过同样的问题。在最新的通过brew(7.4.430和7.4.430_1)提供的vim版本中,这似乎是一个bug。

I did not find any workaround and had to rollback to the previous one that is working fine (7.4.335).

我没有找到任何变通方法,不得不回滚到以前的工作(7.4.335)。

To do so:

这样做:

brew rm vim
brew update
cd /usr/local
git checkout 2150e2d2a89f79f3ab58490433e91f7a36ebf150
brew intall vim
git checkout master
brew cleanup

If you get a 404 when trying to download vim, edit the formula file in /usr/local/Library/Formula/vim.rb and replace:

如果在尝试下载vim时得到404,请在/usr/ local/library/formula /vim中编辑公式文件rb和替换:

by

通过

#4


0  

I face the same issue, E353: Nothing in register * using Ubuntu 14.04 which has vim version: 2:7.4.052-1ubuntu3 installed from its default PPA repository.

我面临着同样的问题,E353:使用Ubuntu 14.04没有注册*,它有vim版本:2:7.4.052-1ubuntu3,安装在默认的PPA存储库中。

Was working OK with vim version : 7.3

使用vim版本7.3是否可以工作

Work around : You can use below options :

变通:您可以使用以下选项:

  1. Use vim -p to open multiple panes. Eg: vim -p file1 file2 and copy and paste as necessary. To move between panes, you can use ":tabn" or ":tabp"
  2. 使用vim -p打开多个窗格。例如:vim -p file1 file2,并根据需要复制和粘贴。要在窗格之间移动,可以使用“:tabn”或“:tabp”
  3. If using Nerdtree plugin with your vim, then also you can simply yank and navigate to the destination file and do a paste.
  4. 如果在vim中使用Nerdtree插件,那么您也可以简单地拖拽并导航到目标文件并进行粘贴。

#5


0  

I've tried in many ways, I can get from the Internet to solve this problem, But finally, the solution is removing your configuration "set clipboard=uname" in your vimrc. I'm trying to find why it works...

我已经尝试了很多方法,我可以从Internet上获得解决这个问题的方法,但是最后,解决方案是删除vimrc中的“set clipboard=uname”配置。我想找出它为什么有效……