tmux-fzf for buffer list
kurktchiev opened this issue · 14 comments
This would be awesome as then with a quick binding you can pop up a nice "clipboard history" pop-up
I will try it out, but why add an external dependency when there is a built in paste buffers and already ways to integrate with different clipboards? Also, I would suggest looking into CopyQ it’s cross platform (a little more so than clipster) but maybe a little less friendly on the script integration side
but why add an external dependency when there is a built in paste buffers and already ways to integrate with different clipboards
Can we access system clipboard history using tmux? I can't figure out how to do it.
Clipster is used to store system clipboard history, what's the advantage of copyq compared to clipster?
Can we access system clipboard history using tmux? I can't figure out how to do it.
Yes! I do it like this:
# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# copy to Windows clipboard
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"'
But also you can use tmux-yank (https://github.com/tmux-plugins/tmux-yank) which adds a few other niceties.
As far as why CopyQ over Clipster, they do the same thing, but CopyQ is more mature, albeit probably a bit more complicated for this usecase. In reality as I said it would make more sense to rely on the built in buffers and something like above to minimize dependencies and speed things up.
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
This command basically bind a key that can save the copied content in tmux to system clipboard, right? But if I copied some text in firefox, then I cannot see it in this buffer. That's why we need an external clipboard manager.
I'll add support for copyq later, you can choose the one you prefer.
This command basically bind a key that can save the copied content in tmux to system clipboard, right? But if I copied some text in firefox, then I cannot see it in this buffer. That's why we need an external clipboard manager.
https://github.com/brennanfee/tmux-paste this actually implements it and its relatively straightforward, it just reverses the process and uses the OS specific paste command (in OSX pbcopy
and pbpaste
)
After a quick glance at the readme, it seems that this plugin integrates the paste command to tmux paste-buffer
. Can we access the system clipboard history using this plugin?
Yes, look here https://github.com/brennanfee/tmux-paste/blob/66eba031be12d519d0b719bbc89cb37fe057e7e5/scripts/helpers.sh#L89-L124 this bascially reverses what https://github.com/tmux-plugins/tmux-yank does, which is add to tmux buffer AND to system clipboard on copy
That's cool! I'm going to try it later, thanks!
I just tried this plugin, it only saves the system clipboard content to tmux buffer when I press prefix + ], not when I copy the content from browser. This means some of the copied contents will be lost.
By using clipster, the copied content is saved immediately when I press Ctrl+C (i.e. everything you copied will be saved).
But it's OK to use tmux-fzf along with this plugin, no more optimization is needed, since I've already added the clipboard-buffer action which will only select the copied content from tmux buffers.
hmm that doesnt seem to be the behaviour i experience at all. when i copy something to system clipboard and then paste into tmux it pastes whatever i copied into my system clipboard
Try this:
- Copy A from your browser, but not paste it to tmux.
- Copy B from your browser, and paste it to tmux.
- Execute
tmux list-buffers
and you'll only see B.
yeah but thats system clipboard behavior :), by default any "normal" system clipboard only keeps the most current copy buffer. However, i do see where my original request and what we are talking about now have diverged. Thanks for current implementation!