2

I use tmux to copy text while in copy-mode often, but what I'd like to do is copy text using command line instead of entering copy-mode.

For example, when I'm in vim directly on my mac computer, I like to select a line with V, then pipe that to the system clipboard with by pressing :, which then gives the '<,'>, meaning, take the currently highlighted vim text, and then w ! pbcopy. Pipe the highlighted vim text to system clipboard. This is useful when the line is too long to render so that tmux's copy-mode can "see" it, and I don't want to set wrap in vim.

I'd like to do the same for tmux, like, if this were a thing:

$ echo "some text" | tmux copy-buffer

Or, after highlighting a line with V in vim:

:'<,'>w ! tmux copy-buffer

Alas, I couldn't find anything in man tmux that suggested I could do this. Anyone know how?

1 Answer 1

1

Sounds like you want

tmux load-buffer -
1
  • Thank you! From within vim, this is how I'm able to highlight a very long line and write it to the tmux copy buffer: :'<,'>w ! cat | tmux load-buffer -. Perhaps a useless use of cat, but I'm happy. Also, from terminal, echo "some text" | tmux load-buffer - works as expected. Mar 29, 2019 at 3:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .