I am trying to create a binding so that tmux
copies last executed command to its copy buffer.
I tried following key bindings but it does not work. What happens when I press F5
is as follows:
- tmux shows copy mode without moving up
- I have to press q to exit copy mode
- tmux then sends the key up, so shell shows last execute command
tmux's copy buffer has just newline
bind-key -n F5 send-keys Up \; send-keys C-a \; copy-mode \; send-keys -X begin-selection \; send-keys -X begin-selection \; send-keys -X end-of-line \; send-keys -X copy-selection
I am using tmux 2.5
and connected to a server from which I connect to different servers in different tmux windows.
Essentially I want to execute the command on all windows by copying the last command in copy buffer and then pasting it different windows for replicating.