Closed jclark-dot-org closed 5 months ago
In custome module above the content of text
is the output of $HOME/bin/gitbranch "#{b:pane_current_path}"
at the time of loading the the catppuccin plugin.
You want to the command in branch
every startus update:
branch="#( /home/user/projects/catppuccin-tmux-dev/test123.bash #{pane_current_path} )"
text="$(get_tmux_option "@catppuccin_test123_text" "$branch")"
#{b:pane_current_path}
gives basename $(pwd)
if you want the full name it's #{pane_current_path}
Perfect, thanks!
I'd like to display the current git branch of the current directory in my status line. I wrote a script,
gitbranch
, that extracted the current branch name in the current directory, but it only ever showed the branch of the directory wheretmux
was run from. Not great, but not surprising.So, I modified my script; you can now pass it a directory, and it will return the current branch in that directory. But how do I pass the current directory to the command, inside my custom module?
I took a look in
status/directory.sh
; it grabs the current directory thusly:I tried to adapt this in my custom module:
(To clarify: my module is
~/.tmux/plugins/tmux/custom/gitbranch.sh
, and it calls~/bin/gitbranch
to get data to display)That didn't work either, so I added logging to my
gitbranch
command, so I could see what param was being passed in:"#{b:pane_current_path}"
passes in#{b:pane_current_path}
"${b:pane_current_path}"
passes in null"${pane_current_path}"
passes in nullAt this point I'm just guessing. What's the correct way to get the equivalent of the "directory" module (the current directory of the current pane, aka
pane_current_path
) and pass it to a command in a custom module?