A Fish shell function that automatically renames Zellij tabs based on the current directory when using cd.
- Automatically updates tab names to match the current directory
- Only renames default tabs (e.g., "Tab #1") or previously auto-renamed tabs
- Preserves manually renamed tabs
- Configurable prefix to mark auto-generated names
Add the function to your Fish configuration:
# ~/.config/fish/functions/cd.fish or ~/.config/fish/config.fish
function cd
# ... (paste the function code here)
endReload your Fish configuration:
source ~/.config/fish/config.fishChange navigation command (default uses z from zoxide):
# Change this line:
z $argv
# To use regular cd:
builtin cd $argvCustomize the prefix:
set prefix "*" # Results in: *project-name
set prefix "dir:" # Results in: dir:project-name
set prefix "[auto] " # Results in: [auto] project-nameTab #1 → cd ~/projects/my-app → *my-app
Tab #2 → cd ~/documents → *documents
"my-custom-name" → cd ~/projects → "my-custom-name" (unchanged)
*old-project → cd ~/new-project → *new-project (updated)
- Fish Shell
- Zellij terminal multiplexer
- Optional: zoxide for the
zcommand