Closed lucasqueiroz closed 1 month ago
It looks like that something that could be handled from tmux configuration rather than in gitmux.
The fact that gitmux returns an empty string when outside a git dir should help, as you hinted the issue description.
What did you try, and what didn't work?
I'd expect something like the following to work. Create a script, put it into your PATH, and call that script instead of calling gitmux directly from your tmux.conf:
output="$(gitmux)"
if [[ -n $output ]]
then
printf "$output"
else
printf "not git dir"
fi
Note that I haven't tried it though
I've found that set -g status-right "#{?#{==:#(gitmux \"\#{pane_current_path}\"),''},not git dir,#(gitmux -cfg $HOME/.gitmux.conf \"\#{pane_current_path}\") }"
Works as well id you don't want to deal with another external script.
Is your feature request related to a problem? Please describe. It would be nice to have a "default" return from the command in case the directory passed as argument is not a git dir. Currently, it returns an empty string, but I would like to be able to customize this to return a specific string when the directory isn't a git dir.
Describe the solution you'd like An option in the config file to have a formatter for this. Maybe add an option to the layout list, or have it be separated and empty as default?
Describe alternatives you've considered Sedding with a default value, but I couldn't get tmux to work the the
| sed ...
, so it doesn't help.Additional context Honestly, I'm using this with catppuccin and when the dir is not a repo, it looks very ugly, so I wanted to have a default to be placed.