gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.79k stars 3.36k forks source link

How to extract the copy-rich feature from this config for personal tmux configs? #756

Closed HarshalRathore closed 3 weeks ago

HarshalRathore commented 3 weeks ago

I am trying to break apart this config and trying to extract the copy functionality that you have implemented (BTW it is great i mean i have tried other copy plugins and they don't even come close to it thanks a lot) how do I do this?

gpakosz commented 3 weeks ago

Hello @HarshalRathore,

I'm afraid it's going to be all uphill. Maybe you don't need to extract anything? tmux has evolved quite a lot since I added this feature and maybe the latest version supports what you need: https://github.com/tmux/tmux/wiki/Clipboard

HarshalRathore commented 3 weeks ago

Thanks for your prompt reply. Yes, I have been trying to make this mess of a script work for the past 16~ish hours but to no avail :sob:. Actually i want to ask that the functionality in your config to enter copy mode with <prefix>+Enter how can i recreate that not the copy part? any guidance would be appreciated thanks.

gpakosz commented 3 weeks ago

I'm not sure what you're after...

This is a stock tmux binding:

bind-key    -T prefix       Enter                  copy-mode
HarshalRathore commented 3 weeks ago

Sorry my bad for not describing correctly what i wanted, but anyway i looked at docs that you mentioned and seems like tmux is preety self-sufficient in this copy-paste thing this is what i came up with

bind Enter copy-mode -e # enter copy mode

# Use vi-style key bindings in copy mode
setw -g mode-keys vi

bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi C-v send -X rectangle-toggle
bind -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi Escape send -X cancel
bind -T copy-mode-vi H send -X start-of-line
bind -T copy-mode-vi L send -X end-of-line

It is working exactly how it was working with your stock config I think I don't even need to download any plugin like tmux-yank I don't know why though all those online articles show that we need this for this copy paste functionality i didn't even set how it'll copy selected text but tmux some how is doing this all by it self.