matanc1
matanc1

Reputation: 7043

Use Mac OS clipboard with Vim

I'm using Vim (version 7.4) in iTerm (inside a Tmux Session) and I can't seem to access the system's clipboard. I want to be able to copy and paste to and from Vim.

I'm using the Vim that came preinstalled with MacVim ('/Applications/MacVim.app/Contents/MacOS/Vim') and I've tried using "+y, "*y etc.

When I run vim --version | grep clipboard I see that I have +clipboard and -xterm_clipboard. From what I read online I should be able to use the +,* registers with these settings.

I've tried finding a solution and none of the proposed ones seemed to work.

Is anyone aware of a way to get this to work?

Is there no solution?

Upvotes: 2

Views: 369

Answers (1)

user1902824
user1902824

Reputation:

You will want to have tmux open shells in an application called reattach-to-user-namespace.

For example, in your .tmux.conf:

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

The easiest way to install reattach-to-user-namespace is with Homebrew.

Upvotes: 2

Related Questions