arl / tmux-gitbar

Git in your tmux status bar
GNU General Public License v3.0
170 stars 16 forks source link

No bar on tmux 2.1. #47

Closed vigneshwerv closed 7 years ago

vigneshwerv commented 7 years ago

Output of tmux -V && echo $SHELL:

tmux 2.1
/bin/bash

My ~/.tmux.conf file can be found at this link (my GitHub repository).

I've tried cd'ing into directories that contain a git repository and I'm seeing no change in my tmux status bar. I don't seem to understand what the problem is.

PS - I'm fairly new to tmux so I may be missing out on something crucial.

arl commented 7 years ago

Hi i just tried your configuration (with tmux v2.2) and i see the git bar as soon as i enter in a git working tree. Which terminal are you using? on which platform?

arl commented 7 years ago

Wait, forget about my last message, i had some other tmux sessions opened when i tried your conf file, so it was basically ignored. After having closed all the sessions, i could reproduce the problem. So let me a bit of time and I'll investigate

arl commented 7 years ago

@vigneshwerv I found the problem, or the problems I should say as there are different variables coming into play. Here is the diff of your .tmux.conf.

52c52
< set -g default-terminal "xterm"
---
> set -g default-terminal "screen-256color"
84c84,91
< set-window-option -g clock-mode-colour green #green
\ No newline at end of file
---
> set-window-option -g clock-mode-colour green #green
> 
> set -g status-left ""
> set -g status-left-length 80
> 
> # enable tmux-gitbar
> TMUX_GITBAR_CONF="$HOME/.tmgb.conf"
> source-file "$HOME/.tmux-gitbar/tmux-gitbar.tmux"

1. If you set default-terminal to xterm, the $PROMPT_VARIABLE installed by tmux-gitbar to get the git status and update the tmux status bar is somewhow overwritten with __vt_prompt_variable.

NOTE: the remaining lines should lie at the very end of your file.

2. There are different things here: a. I see that you kept the default tmux status bar. No problem with that, it's just that tmux-gitbar expect at least the left or right part of the status bar to have been be set through the status-left or status-right variables, so as to modify it and add git status to it. I'll add an issue about that. b.So let's say you want to keep the right part of tmux status bar to its default value and show git status to the left.So we do: set -g status-left "", and set -g status-left-length 80 to leave it enough space in case you have long branch names.

3. Now we need to enable tmux-gitbar. Those steps are documented in the README.md a: set TMUX_GITBAR_CONF env var. b: source tmux-gitbar.tmux

Last thing, the default is to show git status to the right, but because you want it to the right, you must modify the git bar location in the tmux-gitbar conf file (auto-generated at first launch in $HOME/.tmgb.conf)

You should be all set! Enjoy

AlexKvazos commented 7 years ago

Having the same issue, updated my .tmux.conf accordingly and no sight of the statusbar, I have to run update-gitbar to see it.

$ echo $PROMPT_COMMAND
/Users/alex/.tmux-gitbar/update-gitbar;
arl commented 7 years ago

@AlexKvazos If running update-gitbar manually shows it, and if your PROMPT_COMMAND is correctly set, which seems to be the case, that means you should be all set... try to exit all tmux sessions, kill tmux and restart it. Running the PROMPT_COMMAND directly should work also

Le 1 mai 2017 01:30, "Alejandro Cavazos" notifications@github.com a écrit :

Having the same issue, updated my .tmux.conf acordingly and no sight of the statusbar, I have to run update-gitbar to see it.

$ echo $PROMPT_COMMAND /Users/alex/.tmux-gitbar/update-gitbar;

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aurelien-rainone/tmux-gitbar/issues/47#issuecomment-298261681, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdF6vaC9NGa_9VojGKfTLhpTtwcS_oCks5r1QufgaJpZM4NIaSy .

AlexKvazos commented 7 years ago

I killed tmux server and restarted and no, I only get to see an updated status bar if I manually run the command. I installed tmux in default directory all the time

AlexKvazos commented 7 years ago

Here is my tmux.conf https://hastebin.com/malahemesu.bash

arl commented 7 years ago

Which shell are you using? bash should execute the content of PROMPT_COMMAND each time you run a command. Only bash is supported at the moment

Le 1 mai 2017 07:37, "Alejandro Cavazos" notifications@github.com a écrit :

Here is my tmux.conf https://hastebin.com/malahemesu.bash

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aurelien-rainone/tmux-gitbar/issues/47#issuecomment-298264715, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdF6j_Vt2BTSbBhTrAaIn2qneLzogzTks5r1RtGgaJpZM4NIaSy .

AlexKvazos commented 7 years ago

I figured last night haha, anyways, I used a zsh hook to run $PROMPT_COMMAND each time I input something. Thank you!

arl commented 7 years ago

@AlexKvazos Glad that you figured it out and sorry for the late reply, I was on holidays :-) I should update the README as it never mention that using bash is a requirement, you're not the first one to try to use tmux-gitbar with another shell. It would be nice if the shell was auto-detected. Can you show me the code you are using to hook update-gitbar to zsh?

AlexKvazos commented 7 years ago

I got the solution from here. https://superuser.com/questions/735660/whats-the-zsh-equivalent-of-bashs-prompt-command

:)

arl commented 7 years ago

thanks