- Fuzzy search and switch sessions and windows.
- Create new sessions.
- tmux-fzf have more black magic.
- tmux-fzf have single shortcut for switch session and many function tmux-fzf had.
This plugin offers a single shortcut for switching between sessions, windows, and creating new sessions.
This creates a simple workflow: "I want to go to [session/window name], press the shortcut, type the name, and press enter. Done!"
Or:
"I want to go to [session/window name], press the shortcut, type the name. Uh oh, it doesn't exist. Okay, press enter
to create a new session with that name."
Blazingly fast Tmux workflow, built muscle memory, better developer experience.
Having multiple features like tmux-fzf
- Tmux >= 3.3a (for the
pop-up menu
feature) - fzf
-
Install the Tmux Plugin Manager (TPM):
Follow the instructions at https://github.com/tmux-plugins/tpm to install TPM.
-
Add the Plugin to Your Tmux Config:
Add the following line to your
~/.tmux.conf
file:set -g @plugin 'vndmp4/tmux-fzf-session-switch'
-
Install the Plugin:
Use TPM to install the plugin. By default, you can press
prefix + I
(whereprefix
is your tmux prefix key, usuallyCtrl + b
, andI
isShift + i
). -
Open FZF for Session Switching:
Press
prefix + Ctrl + f
to open FZF in a new tab. (For example, if your prefix isCtrl + b
, holdCtrl
, pressb
, then pressf
). -
Creating New Sessions:
If you type a session name that doesn't exist, you will be prompted to create it.
- Handling Name Conflicts: If the name conflicts with an existing session, enclose it in double or single quotes (e.g.,
'example'
).
- Handling Name Conflicts: If the name conflicts with an existing session, enclose it in double or single quotes (e.g.,
set-option -g @fzf-goto-session-only 'true'
set -g @fzf-goto-session 'key binding'
Eg. to override the default session switcher in tmux available at
prefix + s
:
set -g @fzf-goto-session 's'
set -g @fzf-goto-session-without-prefix 'true'
set -g @fzf-goto-win-width WIDTH
set -g @fzf-goto-win-height HEIGHT
Eg.
set -g @fzf-goto-win-width 70
set -g @fzf-goto-win-height 20
Enable this option
set -g @fzf-goto-preview-enabled 'true'
Custom
set-g @fzf-goto-preview-width-preview WIDTH
set-g @fzf-goto-preview-height-preview HEIGH
Using in the Command Line
function tmux_session_switch() {
session=$(tmux list-windows -a | fzf | sed 's/: .*//g')
tmux switch-client -t "$session"
}
function tmux_kill_uname_session() {
echo "kill all unname tmux session"
cd /tmp/
tmux ls | awk '{print $1}' | grep -o '[0-9]\+' >/tmp/killAllUnnameTmuxSessionOutput.sh
sed -i 's/^/tmux kill-session -t /' killAllUnnameTmuxSessionOutput.sh
chmod +x killAllUnnameTmuxSessionOutput.sh
./killAllUnnameTmuxSessionOutput.sh
cd -
tmux ls
}
Using this with the clear
command is effective:
alias clear='tmux_kill_uname_session ; clear -x'