title: Vim - use vim with clipboard inside tmux on mac
body: <p><strong>Objective:</strong> I want seamless integration between (1) tmux copy/paste buffer, (2) system clipboard, (3) Vim <code>"*</code> or <code>"+</code> registers.  I do not want Vim to default to clipboard integration on every yank and put; I want to explicitly invoke it with either of these registers.</p>
  
  <p><strong>Status:</strong> This works as expected when I run Vim outside of tmux.  Integration between tmux copy/paste and my clipboard also works fine (without <code>reattach-to-user-namespace</code>).  My only problem is when I am running Vim inside tmux and want to use these registers - in this case they behave entirely separately from either my system clipboard of tmux copy/paste buffer.</p>
  
  <p>I don't think I should need <code>reattach-to-user-namespace</code> because already my tmux/clipboard integration works correctly outside of Vim.  I don't think I need <code>set clipboard=unnamed</code> because I want to use the default clipboard registers.  But I'm not entirely sure what I <em>do</em> need.</p>
  
  <p><strong>Specs &amp; Settings:</strong> I am running OS X Sierra 10.12.3, tmux 2.3, and Vim 8 with <code>+clipboard</code>.  I am running this all in iTerm 2 (build 3.0.14), not using the iTerm-tmux integration, and with "Applications in terminal may access clipboard" enabled. Below are the settings I think might be relevant from my dotfiles.</p>
  
  <p><code>~/.tmux.conf</code>:</p>
  
  <pre><code>set-option -g focus-events on
  bind-key v copy-mode
  bind-key p paste-buffer
  bind-key -t vi-copy v begin-selection
  bind-key -t vi-copy y copy-selection
  bind-key -t vi-copy Enter copy-selection
  bind-key -t vi-copy MouseDragEnd1Pane copy-selection
  bind-key -t vi-copy r rectangle-toggle
  </code></pre>
  
  <p><code>~/.vimrc</code></p>
  
  <pre><code>Plugin 'tmux-plugins/vim-tmux-focus-events'
  Plugin 'christoomey/vim-tmux-navigator'
  </code></pre>
  
  <p>If there are other settings that may be relevant I'm happy to add to this list upon request.  I don't want to post my full <code>tmux.conf</code> and <code>vimrc</code> files because that would just be bloated.</p>
  
  <p><strong>Not A Duplicate:</strong> There are a lot of questions related to Vim/tmux clipboard integration in OS X, and I've read through them but I'm still having trouble.  I don't think this is a duplicate of those questions.</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong> I tried using <code>reattach-to-user-namespace</code> and it worked perfectly.  I don't understand why Vim needed this but just regular copy/paste from tmux did not.</p>