11

I recently installed the latest version of TMux and when I tried to switch between my windows (control-a w, or choose-tree) I was greeted with 3 entries instead of 2. Instead of only showing my windows TMux now insists on showing an extra session entry which 'contains' my windows.

Something I really don't need because I only use one session on my servers. And seeing 3 entries while I only have 2 windows is extremely counter-productive for me. I found the filtering options and eventually tried "#{==:#{window_index},>1}" which worked. However...

Unfortunately the filter option doesn't seem to filter the entire screen but only the entries within the session entry. While it's the session entry line I want to get rid off.

So summing up: I want to make TMux behave as it always used to, so it should show me my window entries and nothing else.

Thanks in advance.

5
  • choose-tree is not the command you want. choose-window is your choice.
    – Tagwint
    Oct 23, 2017 at 21:02
  • 2
    Incorrect. First; choose-window isn't mentioned in the manual page, second; it seems to be an internal alias for choose-tree because it behaves exactly the same.
    – ShelLuser
    Oct 23, 2017 at 21:23
  • could you specify your tmux version?
    – Tagwint
    Oct 23, 2017 at 22:02
  • Already did (somewhat): latest version, aka 2.6.
    – ShelLuser
    Oct 23, 2017 at 22:36
  • That must be the difference. Mine is tmux 2.5, the latest for my distributive. It has select-window in man pages, bound to pfx+w, unlike select-tree bound to pfx-s. The latter behaves like you described, but the first like you want it to.
    – Tagwint
    Oct 23, 2017 at 22:44

4 Answers 4

9

This is working for me in tmux 2.6.1 using termite and the standard linux virtual terminal. Make sure you have the latest version of tmux, also try restarting tmux completely since changes do not always apply after reloading the config.

choose only sessions

bind-key -r -T prefix s choose-session

bind-key -r -T prefix s choose-session

choose only windows in current session

bind-key -r -T prefix w run-shell 'tmux choose-tree -Nwf"##{==:##{session_name},#{session_name}}"'

enter image description here

choose both session and windows

bind-key -r -T prefix S choose-window

enter image description here

7
  • Neither of this solves the problem because although you can only choose windows in the current session the session bar is still displayed. You still have 3 lines with only 2 open windows. And that's what I'm trying to get rid off.
    – ShelLuser
    Oct 26, 2017 at 22:03
  • Thanks for this! I'd also like to not have the session name displayed, but limiting windows to the current session is much better for my use case than the default.
    – Henrik N
    Mar 14, 2018 at 12:04
  • @ShelLuser I don't think there's a way to do that. According to the documentation as of tmux 2.6 you cannot nest filters together. You're just going to have to settle for having the session name showing + the session's windows.
    – Zypps987
    Mar 16, 2018 at 5:28
  • I'm removing this again because the up/down arrow keys don't seem to work well in the list of windows. A lot of the time I press an arrow key and nothing happens.
    – Henrik N
    Mar 22, 2018 at 8:46
  • @HenrikN make sure you have xterm-keys on in your tmux config.
    – Zypps987
    Apr 5, 2018 at 2:37
1

This is an old question, but if it is still relevant: The preview in :choose-tree (i.e. C-s or C-w in newer versions) can be toggled with v.

I'm not a key binding guru, but I'm sure there would be a way to rebind - to pass the v toogle to choose-tree when it is launched.

See: https://github.com/tmux/tmux/issues/1114#issuecomment-336055045

Refs: OpenBSD Tmux Ref Tmux FAQ

0

This works for me.

https://github.com/tmux/tmux/issues/1115

bind-key -r -T prefix w run-shell 'tmux choose-tree -Nwf"##{==:##{session_name},#{session_name}}"'
1
  • Thanks but all that does is put the focus on the current window, but it doesn't get rid of the first session line. So if you just start TMux and have 1 active window you still see 2 entries in the window selection ('choose tree').
    – ShelLuser
    Oct 24, 2017 at 21:19
0

There was a significant rewrite of the choose mode in tmux 2.6 (https://raw.githubusercontent.com/tmux/tmux/2.6/CHANGES).

The option to start choose-tree with the sessions collapsed is choose-tree -s.

You must log in to answer this question.

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