You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Git information shows up in status bar when in a git repo.
Actual Behavior
It doesn't.
Steps to Reproduce the Problem
On Raspbian jessie, install gitmux and put set -g status-right '#(gitmux "#{pane_current_path}")' in ~/.tmux.conf, and re-source.
Go to a git repo.
Run gitmux manually, which seems to produce sensible output: #[fg=default]#[fg=default]#[fg=white,bold]⎇ #[fg=default]master#[fg=default]..#[fg=cyan]origin/master#[fg=default]#[fg=default] - #[fg=red,bold]✚ 1 #[fg=cyan,bold]⚑ 1 #[fg=magenta,bold]…1
Observe lack of git info in status bar.
Specifications
OS: Raspbian GNU/Linux 8 (jessie)
gitmux version: 0.4.1
tmux version: 1.9
Same setup works for me on a x86 box with tmux 2.1. Any ideas?
Uhm it seems that tmux 1.9 does not support #{pane_current_path} in tmux.conf.
The problem is not gitmux per se, but how to have it automatically called by tmux on user actions (switch paned ,change for, etc.). Without a recent tmux version, you'll have to implement a solution based on your shell, such as one based on $PROMPT_COMMAND for bash, in order to have gitmux be automatically called.
Tmux is very easy to compile, IMO the simplest solution is to build a recent ARM version.
I tried set -g status-right '#(gitmux "$PWD")': It gets the output of wherever you launch tmux from, but then never updates. I can just build a >2.0 version -- maybe add a warning about <2.0 to the README? Or is there something else you'd like me to try so you can keep the "Works with all tmux versions" claim?
Thank you for your work -- I'm finding this a very useful addition to my setup.
Ok It seems that tmux < 2.0 generates it's status statically.
The only way I see to make it work, only on bash btw, is to to call tmux set -g status-right "#(gitmux $PWD)" from within a PROMPT_COMMAND, which is a bit more involved since you have to do it in .bashrc in order to have it work then on any tmux session.
export PROMPT_COMMAND="tmux set -g status-right \"$(gitmux $PWD)\""
I may have forgotten or added too much escaping but I know that works since I was doing like that in https://github.com/arl/tmux-gitbar
Thank you for your patience, tell me your results and I'll update the README.
This seems to work reasonably well: export PROMPT_COMMAND='tmux set -g status-right "$(gitmux $PWD)" &> /dev/null'
Redirecting both STDERR and STDOUT seems necessary, or tmux will spam output on every command. For me I think building a recent tmux is a better way to go but hopefully this will be useful to someone.
changed the title [-]Not working on Raspbian (ARM) / tmux 1.9[/-][+]documentation: add warning & possible solution for tmux < 2.1 (since #{pane_current_path} was not supported)[/+]on Mar 6, 2020
changed the title [-]documentation: add warning & possible solution for tmux < 2.1 (since #{pane_current_path} was not supported)[/-][+]documentation: add warning+solution for tmux < 2.1 - #{pane_current_path} not supported[/+]on Mar 6, 2020
This comes with the caveat that other programmes also set the title such as Vim. You then have to work around those cases individually. In the case of Vim, put this in your .vimrc:
set titlestring=%{getcwd()}
@arl you may want to change future instructions to use pane_path instead of pane_current_path which is a dedicated way for the pane to self-report the path through OSC 7:
Activity
arl commentedon Mar 4, 2020
Uhm it seems that tmux 1.9 does not support
#{pane_current_path}
intmux.conf
.The problem is not gitmux per se, but how to have it automatically called by tmux on user actions (switch paned ,change for, etc.). Without a recent tmux version, you'll have to implement a solution based on your shell, such as one based on
$PROMPT_COMMAND
for bash, in order to have gitmux be automatically called.Tmux is very easy to compile, IMO the simplest solution is to build a recent ARM version.
arl commentedon Mar 4, 2020
Just saw this, have a look at the unique answer: https://unix.stackexchange.com/questions/233929/tmux-2-0-pane-current-path-not-working-on-centos/234222#234222
If that works, or if you find another shell-independent solution I'll update the README accordingly
mattias-lidman commentedon Mar 4, 2020
I tried
set -g status-right '#(gitmux "$PWD")'
: It gets the output of wherever you launch tmux from, but then never updates. I can just build a >2.0 version -- maybe add a warning about <2.0 to the README? Or is there something else you'd like me to try so you can keep the "Works with all tmux versions" claim?Thank you for your work -- I'm finding this a very useful addition to my setup.
arl commentedon Mar 4, 2020
Ok It seems that tmux < 2.0 generates it's status statically.
The only way I see to make it work, only on bash btw, is to to call
tmux set -g status-right "#(gitmux $PWD)"
from within a PROMPT_COMMAND, which is a bit more involved since you have to do it in.bashrc
in order to have it work then on any tmux session.export PROMPT_COMMAND="tmux set -g status-right \"$(gitmux $PWD)\""
I may have forgotten or added too much escaping but I know that works since I was doing like that in https://github.com/arl/tmux-gitbar
Thank you for your patience, tell me your results and I'll update the README.
mattias-lidman commentedon Mar 4, 2020
This seems to work reasonably well:
export PROMPT_COMMAND='tmux set -g status-right "$(gitmux $PWD)" &> /dev/null'
Redirecting both STDERR and STDOUT seems necessary, or tmux will spam output on every command. For me I think building a recent tmux is a better way to go but hopefully this will be useful to someone.
Cheers.
arl commentedon Mar 4, 2020
Great! Thanks for reporting
[-]Not working on Raspbian (ARM) / tmux 1.9[/-][+]documentation: add warning & possible solution for tmux < 2.1 (since #{pane_current_path} was not supported)[/+][-]documentation: add warning & possible solution for tmux < 2.1 (since #{pane_current_path} was not supported)[/-][+]documentation: add warning+solution for tmux < 2.1 - #{pane_current_path} not supported[/+]casr commentedon May 5, 2020
The OpenBSD version of tmux hasn't had
pane_current_path
for a few versions now so I worked around it by abusing the dynamic titles feature.With your shell prompt you set the title to the current path:
Then use this in
.tmux.conf
(in my case it was so that a pane split takes the current pane's path):This comes with the caveat that other programmes also set the title such as Vim. You then have to work around those cases individually. In the case of Vim, put this in your
.vimrc
:@arl you may want to change future instructions to use
pane_path
instead ofpane_current_path
which is a dedicated way for the pane to self-report the path through OSC 7: