6

While inside of tmux, I can press PREFIX w, which runs tmux choose-tree. This brings up an interactive session/window/pane selector that also displays a preview of the highlighted node.

From a normal shell outside of tmux, I can run tmux attach -t '$1:1' to attach to any session or window by name or index (see man tmux section "Clients And Sessions").

Is there command similar to tmux attach -t where I can pass in a session/window name/index and see a preview of it, like to the one used in tmux choose-tree? Ideally this command would just show the lower portion of this image:

Running <code>tmux choose-tree</code>

The goal here is to pipe a list of tmux windows from all sessions to fzf, and pass a separate command in fzf's --preview flag to show a preview of the session/window currently highlighted while fuzzy finding.

I have a draft working here. It populates a preview with the session/window index in a tmux-compliant format and will switch to the selected session.

shender
  • 1,243
  • 13
  • 17

1 Answers1

4

This can be partially implemented by means of this recent commit: https://github.com/tmux/tmux/commit/2628af573d98f7bdd4db02c7a80c860b867a45fb

I do so here: https://github.com/petobens/dotfiles/commit/c21c306660142d93d283186210ad9d301a2f5186 in order to get the following: enter image description here

petobens
  • 1,330
  • 1
  • 12
  • 23
  • Nice, very clean interface. I learned a bunch about fzf and tmux reading your dotfiles. – shender Dec 21 '19 at 06:10
  • Very nice. Here's my stab at taking it a bit further: https://github.com/von/homestuff/blob/main/home/dot_tmux/scripts/executable_tmux-preview.sh – Von Dec 31 '22 at 22:22