Replies: 4 comments
-
My current hack is to have a zsh function which starts on every tab something like below: set_tab_name() {
# If zellij is not running this is a no-op
if [[ -z ZELLIJ ]]; then
return 0
fi
local tabName=""
vared -p "What would you want to call this tab? - " -c tabName
zellij action rename-tab $tabName
} And invoke it at the end of |
Beta Was this translation helpful? Give feedback.
0 replies
-
Another option:
Save this function in ~/.zshrc file. |
Beta Was this translation helpful? Give feedback.
0 replies
-
If you are on fish shell: function zellij_update_tabname
if set -q ZELLIJ
set current_dir $PWD
if test $current_dir = $HOME
set current_dir "~"
else
set current_dir (basename $current_dir)
end
nohup zellij action rename-tab $current_dir >/dev/null 2>&1
end
end
# auto update tabe name on directory change
#
function __auto_zellij_update_tabname --on-variable PWD --description "Update zellij tab name on directory change"
zellij_update_tabname
end If you want to use git root directory function _zellij_update_tabname
if set -q ZELLIJ
set current_dir $PWD
if test $current_dir = $HOME
set tab_name "~"
else
set tab_name (basename $current_dir)
end
if fish_git_prompt >/dev/null
# we are in a git repo
# if we are in a git superproject, use the superproject name
# otherwise, use the toplevel repo name
set git_root (git rev-parse --show-superproject-working-tree)
if test -z $git_root
set git_root (git rev-parse --show-toplevel)
end
# if we are in a subdirectory of the git root, use the relative path
if test (string lower "$git_root") != (string lower "$current_dir")
set tab_name (basename $git_root)/(basename $current_dir)
end
end
nohup zellij action rename-tab $tab_name >/dev/null 2>&1
end
end
# auto update tab name on directory change
function __auto_zellij_update_tabname --on-variable PWD --description "Update zellij tab name on directory change"
_zellij_update_tabname
end |
Beta Was this translation helpful? Give feedback.
0 replies
-
Linking a related issue here #3709 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It appears that zellij's default convention of tab naming is to use some sort of an auto increment index. Is there a way to control this behavior?
here is a scenario:
Tab #1
toTab #10
Tab #1
Tab #11
. Can we not reuse the least available index i.e.,Tab #1
in this case?I thought there might be some configuration parameter for this but couldn't find one in the docs.
Beta Was this translation helpful? Give feedback.
All reactions