I would like to have a command in tmux vi-copy mode, which combines the following three steps into one:
- selects the current line
- copies the selection that was made in step 1
- copy-pipes the copied selection to xargs
Could it look like this?
bind-key -t vi-copy o select-line; copy-selection; copy-pipe "xargs -I{} tmux select-pane -t 1"
I got the last part running like this link:
bind -t vi-copy 'y' copy-selection
bind -t vi-copy y copy-pipe "xclip -sel clip -i"
bind -t vi-copy y copy-pipe "xargs -I{} tmux send-keys -t 1 ';call OpenTestFile(\"{}\")' Enter"
If I select something in copy mode with the above, tmux is:
- copying the selection
- sending the keys:
;call OpenTestFile("SELECTION")
to the pane number 1 (I have vim opened there) - switching to that pane
In the vim-function OpenTestFile(input)
I realize, that vim extracts a filepath from the tmux-line-selection and opens it for editing.
But I don't want to use the y
key, instead I want to use the o
key, for doing that and to avoid to having to select the line before.
Update 1
It seems, that it isn't possible to bind multiple commands in a mode. link