1

When customizing .tmux.conf I often need to try the command on the fly so I want to copy commands from .tmux.conf (being opened in editor) to the command prompt (<c-b> :). I tried <c-b> ] after the command prompt but it does not work.

1
  • doesn't ctrl-y work for you? Commented Jan 30 at 18:54

1 Answer 1

1

It's probably not possible to do without using the system clipboard (which assumes you're running a window manage of some sort).

I have this in my .tmuxrc:

bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"

This means when I hit Enter after selecting something in tmux, it's copied to the system clipboard.

Thereafter, in my terminal I can just hit CtrlShift+v to paste it into the terminal.

This should work for your use case, I think.

2
  • this works only if tmux is running on local server right?
    – UNIX.root
    Commented Jan 15, 2023 at 12:20
  • no -- it assumes its running on your local workstation --- the xclip in particular, requires xwindows to also be running on that machine
    – Brad
    Commented Jan 15, 2023 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .