Samuel
Samuel

Reputation: 171

Pasting in vim on tmux returns this error: E353: Nothing in register *

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

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

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

In .vimrc, I have:

set clipboard=unnamed

In .tmux.conf, I have:

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

Upvotes: 17

Views: 31660

Answers (6)

terano
terano

Reputation: 39

In my case it appeared that the keyboard layout was not the usual qwerty-US-layout, while my desktop icon told me that is was. Therefore the vi commands "yy" to copy and "x" to delete didn't work, because other keys were mapped to it. The "p" to paste was in both keyboard layouts the same key and that's why pasting gave me this error E353: Nothing in register *.

I'm working with Ubuntu (22.04).

The solution for this case is to re-choose the right keyboard layout (even though the desktop icon may not change, why that is, I still have to investigate).

Upvotes: 0

HolaYang
HolaYang

Reputation: 419

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...

Upvotes: 0

maxcnunes
maxcnunes

Reputation: 3027

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

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

Upvotes: 13

Robin
Robin

Reputation: 554

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.

Was working OK with vim version : 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. If using Nerdtree plugin with your vim, then also you can simply yank and navigate to the destination file and do a paste.

Upvotes: 0

user1521531
user1521531

Reputation: 1

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).

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).

I did not find any workaround and had to rollback to the previous one that is working fine (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:

by

Upvotes: 0

romainl
romainl

Reputation: 196799

Try "*y and "*p.

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

set clipboard=unnamed

See :help registers and :help 'clipboard.

Upvotes: 7

Related Questions