Enter copy mode and start searching in one go
bind-key / copy-mode \; send-key ?
allows you to do just:
Ctrl + B /
and start typing the search term, which will search up (latest lines first).
Dump to a file and use vim
When things get more involved, I just want to use a proper editor: https://unix.stackexchange.com/questions/26548/write-all-tmux-scrollback-to-a-file
bind-key P 'capture-pane' \; capture-pane -S - \; save-buffer /tmp/tmux \; delete-buffer
Now P
dumps the buffer to a file, and then I just:
vim /tmp/tmux
We can automate things even further as suggested by automatically opening vim as well as suggested by pkfm:
bind-key v 'capture-pane' \; \
capture-pane -S - \; \
save-buffer /tmp/tmux \; \
delete-buffer \; \
send-keys Escape 'ddivim /tmp/tmux' Enter
This supposes that your shell is in vi mode, so that:
- Escape goes into normal mode
dd
clears any existing commandi
goes into insert mode- then we run
vim /tmp/tmux
Tested in tmux 3.0.