When recently on YouTube, a video from Greg Hurrell popped up. I have watched a lot of his videos but must have missed this one because it has the best tip for searching in tmux.
The short of this tip is basically searching back to your terminal prompt. It's so simple I can't believe its took me this long to find it. The main use for this is when you run a command with a lot of output, you can add a key binding to search back to your prompt so you can quickly get back to the start of this output.
I'm using oh-my-zsh and in my theme I am using the ansi characters
⇒ in my prompt. This is what I am using for searching backwards.
Yea there could be that ansi character in the output of the command but 99% of the time this has been fine. You can add a double space into your prompt to reinforce the search pattern.
bind-key b copy-mode\; send-keys -X start-of-line\; send-keys -X search-backward "⇒"\; send-keys -X next-word
Above is the bind-key I have added to my
tmux.conf. I have it bound to
b so after typing
<ctrl>bb the prompt will jump up to the start of the command output.