That is what if-shell exists for: if-shell "[[ $(uname) == 'Darwin' ]]" { #macOS specific options bind-key -T copy-mode-vi y send-keys -X copy-pipe pbcopy } { #linux specific options bind-key -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard" }
On Thu, Jan 28, 2021 at 9:28 PM Peng Yu <pengyu...@gmail.com> wrote: > Hi Sean, > > > > I want to have an identical configure file so that it can allow use > highlight text and type command-C (Mac) or ctrl-shift-C (Linux) for > copying. Basically, I just want the normal behavior of a terminal. Could > anybody let me know the tmux code to figure this? > > > > You might find this guide useful: > > > > https://www.seanh.cc/2020/12/27/copy-and-paste-in-tmux/ > > The "Tmux Plugin Manager" instruction mentioned in the above webpage > is confusing. > > https://github.com/tmux-plugins/tpm > > On the above page it says to add these to ~/.tmux.conf > > set -g @plugin 'tmux-plugins/tpm' > set -g @plugin 'tmux-plugins/tmux-sensible' > > But the clone was only about the first line. How can I add the second > line when it is not cloned? > > $ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm > > > > > It uses the tmux-yank plugin to achieve the cross-platform behaviour. > > > > Also see my tmux config: > > > > https://github.com/seanh/tmux > > Which approach do you recommend? Your approach or the approach on > seanh.cc? What is their difference? > > > This doesn't bind command-c on mac. But this is the line that binds > control-c on linux, you could add a similar line for mac but using > command-c and pbcopy: > > > > bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard" > > So then this file will not be same anymore for both mac and Linux. > Therefore, this solution does not address my original question? > > -- > Regards, > Peng > > -- > You received this message because you are subscribed to the Google Groups > "tmux-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to tmux-users+unsubscr...@googlegroups.com. > To view this discussion on the web, visit > https://groups.google.com/d/msgid/tmux-users/CABrM6w%3D4ci6U5eZC06JXi3TJWMyQAMteAgSYD%3D8J%3DppU3UT3Vg%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "tmux-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+unsubscr...@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/CAH2YjjHmzT%3D5rp7Gv19T_6AzMF9XrqC_PSZTYctjygxT3aR0Sg%40mail.gmail.com.