Yesterday I improved my tmux workflow. Chris Toomey offers some fantastic customization options for your tmux configuration:

Part 5: Advanced Workflow

My favorite is the “fuzzy session switching”. Using this option, you can search your tmux session easily with approximate string matching.

I use fzy:

fzy animated demo

Here is the modified script (add it to ~/.tmux.conf):

# Fuzzy tmux session switching
bind w split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzy | xargs tmux switch-client -t"

What it does:

  • use <prefix> w as the key binding
  • opens a vertical tmux pane
  • list the name of the sessions except the current session
  • pipes these names to fzy
  • pipes these to the tmux switch-client command (instead of standard output)

I highly encourage you to check out the other examples for your tmux configuration.

Further Reading