TMUX Sessionizer is a fzf-based tmux session and project switcher written in Bash.
This is heavily based upon ThePrimeagen's tmux-sessionizer which I found a little non flexible.
- Sometimes, I open Tmux sessions for general use outside of specific projects and wanted a script that lists these one-off sessions alongside projects.
- My projects organization is somewhat disorganized, as I use entirely different directory structures for my work and personal projects.
- I've integrated
git worktree
into my projects, so was looking for a script that can handle such worktree branchs as well.
How does this tmux-sessionizer work?
This script first lists Tmux sessions in FZF, then projects from a file (Default: $HOME/.tmux-sessionizer.list
). You can add or edit entries with tmux-sessionizer add
or tmux-sessionizer edit
.
Some other similar alternatives.
- jrmoulton/tmux-sessionizer - more "feature reach" and built using rust
- joshmedeski/t-smart-tmux-session-manager - uses zoxide
- joshmedeski/sesh - from t-smart-tmux-session-manager's dev built using go
tmux-sessionizer switch
: Fuzzy search through Tmux sessions and projects and switch/create a session for the selected entry.tmux-sessionizer add [path] [name]
: Add a new entry to the list file with the specified path and session name. If no path is provided, it defaults to pwd. If no name is provided, it defaults to basename of path.tmux-sessionizer edit
: Opens the sessionizer list file in editor. Refers$EDITOR
, if not provided defaults tovim
.tmux-sessionizer sanitize
: Remove duplicate and non-reachable entries from the list file.
-
Clone the repository:
git clone https://github.com/mnjm/tmux-sessionizer.git
-
Add the script directory to your
$PATH
environment variable. For example, if you cloned the repository to~/tmux-sessionizer
, add the following line to your shell profile (e.g.,.bashrc
,.zshrc
):export PATH="~/tmux-sessionizer:$PATH"
(or) Copy / link
tmux-sessionizer
script in one of the entries directory in your$PATH
For ex.~/.local/bin
cd ./tmux-sessionizer cp ./tmux-sessionizer ~/.local/bin (or) ln -s $(realpath tmux-sessionizer) ~/.local/bin/
-
(Optional) you can add it as an alias in your shell config (.bashrc or .zshrc):
alias tmuxs='tmux-sessionizer switch' alias tmuxs-add='tmux-sessionizer add' alias tmuxs-edit='tmux-sessionizer edit'
-
(Optional) you can add it as a binding in your tmux config (.tmux.conf):
bind s display-popup 'tmux-sessionizer switch'
Environment variables
TMUX_SEZ_LIST_FILE
: Path to the list file. Default:$HOME/.tmux-sessionizer.list
TMUX_SEZ_FZF_COMMAND
: Custom fzf command. Default:fzf --height 100% --reverse
Contributions are welcome! Feel free to open an issue or submit a pull request
This project is licensed under the MIT License.