tmux-MacOSX-pasteboard icon indicating copy to clipboard operation
tmux-MacOSX-pasteboard copied to clipboard

Not needed for Tmux 2.6+

Open aleksandrs-ledovskis opened this issue 7 years ago • 13 comments

Since https://github.com/tmux/tmux/commit/78352fdd328b611d935ba051288191b33278cc4a and release 2.6 reattach-to-user-namespace trick doesn't seem to be needed.

$ echo "test" | pbcopy
$ pbpaste
test

aleksandrs-ledovskis avatar Oct 08 '17 07:10 aleksandrs-ledovskis

You're right. I removed all the relevant copy vi mode bindings and killed the tmux server (to remove config caching). I can achieve the same result by only supplying the following binding:

bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"

I'm on macOS 10.13 with tmux 2.6

raejin avatar Oct 09 '17 22:10 raejin

Still needed for some cli tools, like trash, or brew home xx

lyuehh avatar Oct 26 '17 04:10 lyuehh

@lyuehh

I did install trash from homebrew and executed

$ cd /tmp/
$ touch 123
$ trash 123

Afterwards, I verified that file "123" indeed was moved to macOS Trash.

Also, I tried brew home with rust and python arguments. Both commands succeeded in opening respective homepages in default browser.

So, appears working for me 🤷‍♂️

aleksandrs-ledovskis avatar Oct 26 '17 08:10 aleksandrs-ledovskis

@aleksandrs-ledovskis On my computer , tmux was needed for trash, I don't known why ...

lyuehh avatar Oct 26 '17 10:10 lyuehh

Can we add to the README some text that says in what tmux/macOS version this is not needed? :)

christopher-francisco avatar Feb 07 '18 14:02 christopher-francisco

I'm not entirely sure if this is even related, but if you're using a recent iTerm there is a option "Applications in terminal may access clipboard" in the Preferences. When it is selected Tmux copies directly to the macOS system clipboard when using copy mode without any configuration. This even works over SSH.

I can access pbcopy et al. (also trash) from within Tmux (version 2.7) on macOS 10.13.4.

luisgerhorst avatar May 16 '18 19:05 luisgerhorst

@raejin are those even needed anymore?? I'm running tmux 2.7 and I can copy/paste to and from, no problem like any other app in mac (mojave)

fdelacruz avatar Jul 23 '18 18:07 fdelacruz

@fdelacruz What method are you using? Aren't you mistaking text selection in terminal using mouse and pressing Cmd+C/Cmd+V vs. programmable copy & paste (as in pbcopy/pbpaste)

aleksandrs-ledovskis avatar Jul 23 '18 18:07 aleksandrs-ledovskis

@aleksandrs-ledovskis Hi, well, I'm not using the mouse. I'm simply selecting the text in vim's visual mode, yanking and pasting outside of tmux. I can do the reverse from any app too. What gives??

fdelacruz avatar Jul 23 '18 19:07 fdelacruz

I'm here wondering what am I doing wrong..

fdelacruz avatar Jul 23 '18 19:07 fdelacruz

@fdelacruz Thing is, @raejin's comment/snippet refers to Tmux copy-mode configuration & is not applicable/affecting applications launched within terminal multiplexer, such as Vim.

Regarding Vim and yank ending up in OS clipboard - could it be that you are yanking to plus/+ register (or have unnamedplus in .vimrc)?

aleksandrs-ledovskis avatar Jul 23 '18 19:07 aleksandrs-ledovskis

@aleksandrs-ledovskis yes, I have mine configured as set clipboard=unnamed. Btw, i just copied from the top command in tmux into vim outside.

fdelacruz avatar Jul 23 '18 20:07 fdelacruz

I'm on tmux 2.9a and I need reattach-to-user-namespace to prevent this issue: https://github.com/macvim-dev/macvim/issues/622

der-flo avatar May 17 '19 11:05 der-flo