Whenever I copy something (usually with a mouse) from a tmux buffer, and paste it later in ViM, the contents are truncated. Last attempt gave me only about 750bytes of the full block I copied.
This is in iTerm on a Mac.
Problem Solved. A few pointers.
reattach-to-user-namespace
is not required. Just pbcopy
.tmux 2.3
MouseDragEnd1Pane
event to fire off pbcopy
.iTerm2
which means that Mouse Support just works.
From tmux v2.1
only set-option -g mouse on
is required.MouseDragEnd1Pane
is bound as belowHere is my stripped down ~/.tmux.conf
# --------------------------------
# Turn on the Mouse Support - defaults seem good
# --------------------------------
set-option -g mouse on
# when we finish "selecting" send it to pbcopy (and into the OS X buffer)
bind-key -t vi-copy MouseDragEnd1Pane copy-pipe "pbcopy"
# --------------------------------
# Use vim keybindings in copy mode
# --------------------------------
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# You enter with C-b [ and then "v" - then normal keypresses to "highlight"
# .. [Enter] or "y" will select (because of below bindings)
bind-key -t vi-copy v begin-selection
#
# 'y'ank will send the selection to the OS X buffer
bind-key -t vi-copy y copy-pipe "pbcopy"
# --------------------------------
# Update default binding of `Enter` to also use Send the selection to OS X buffer
# --------------------------------
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "pbcopy"
# selecting can now be done with
# hilighting with a mouse
# selecting with C-b [ v .. now vi mode for selecting text
#
# pasting can now be done with
# ⌘ - V
# C-b ]
I had the same problem, and was getting the paste step wrong. I came across this post.
What I was trying to do was paste from the system clipboard simply using ctrl-v (which worked, but only partially, as you explained in your question).
Instead, pasting from the tmux buffer using ctrl-b ]
does the job correctly.
I had the same problem using tmux 1.8, iTerm2, and reattach-to-user-namespace
. I ran across a tmux config binding that fixes the problem: it explicitly copies the last buffer selection to the clipboard:
bind-key q run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
Put it in your ~/.tmux.conf
, and then C-b q
will pull everything into your clipboard after a selection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With