Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCS info not updating #52

Closed
ajpaulson opened this issue Sep 22, 2012 · 13 comments
Closed

VCS info not updating #52

ajpaulson opened this issue Sep 22, 2012 · 13 comments

Comments

@ajpaulson
Copy link

Running in Debian.

If I start tmux from within a git/hg/svn repo it shows the vcs info and if I switch branches in that repo it updates...
But if I change directory it still displays the vcs info for the directory I was in before starting tmux and if I started from a non-version controlled directory it never shows up.

@ajpaulson
Copy link
Author

quick edit

running the vcsinfo script via bash -x gives the correct output for whichever directory I'm in.

I use zsh with robbyrussel's oh-my-zsh

I do have bash >4.2 installed and added the PS1 line in the README to the bashrc

@erikw
Copy link
Owner

erikw commented Sep 23, 2012

I don't use zsh my self but I guess it does not read ~/.bashrc by default. Try putting that stuff in your ~/.zshrc. Does that work?

@ajpaulson
Copy link
Author

The thing is I have an extremely modified prompt already in Zsh - I'm not sure how adding that to the zshrc may affect it.

I did try changing shell to bash to see if that was simply the issue but I still get the same problem. - I don't think the PS ! line is the issue. I have also tried in different terminal emulators (I use urxvt as my main one) and again I have the same problem.

@erikw
Copy link
Owner

erikw commented Sep 23, 2012

Well give it a try. That line should preserve the existing changes so put it after the oh-my-zsh stuff how ever that works. I use urxvt as well. Try it in a clean environment with no bashrc (except the line needed for VCS stuff).

@derekbrokeit
Copy link
Contributor

I use zsh 5.0 and the following correctly added the vcs info to the prompt:

PROMPT="$PROMPT"'$([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#I_#P") "$PWD")'

If you add this to the very bottom of your rc-file, it should have no negative affect on your prompt. Using PS1 should also have the same affect since both are linked to the same variable.

@erikw
Copy link
Owner

erikw commented Sep 27, 2012

Did you get it to work @ajpaulson?

@ajpaulson
Copy link
Author

I've been under some tight deadlines at work so I've not had a chance to test yet - I will update once I've tested.

@oarmstrong
Copy link

@erikw I had exactly the same issue and I can confirm that @scicalculator's suggestion fixed it for me. Maybe clarify the README with those instructions?

@erikw
Copy link
Owner

erikw commented Oct 25, 2012

I believe zsh recognizes PS1 as well. But I don't know if PROMPT and PS1 refers to the same variable. Does it work to put the PS1-line from the README in the ~/.zshrc?

@oarmstrong
Copy link

Yup. Would be useful to add to the README to put it in to ~/.zshrc, not quite sure where I was trying to put it at first but it has to be at the bottom of that file.

@erikw
Copy link
Owner

erikw commented Oct 25, 2012

I just cygwin'd zsh and PROMPT seems to be the same thing as PS1. Can you verify that what solves this issue is to use the same line as in the README but appending it to ~/.zshrc instead of ~/.bashrc?

@derekbrokeit
Copy link
Contributor

I can confirm that for me (zsh 5.0) the line as copied from the README works unmodified. The same should also be true for most versions of zsh 4.x (hopefully no one is on earlier versions, for their sake).

@Olliea95 I suspect that you had accidentally put the line too early and then re-wrote PS1 afterwards. It is certainly convenient to put this line at the very bottom, but if you compartmentalize your rc-file then you could put all prompt customization together with this line near-or-at the bottom of that section.

This will work

# will work PS1 will be '$ '
PS1=
PS1="$PS1"'$([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#I_#P") "$PWD")'
PS1='$ '$PS1

This will fail

# will NOT work PS1 will be '$ '
PS1=
PS1="$PS1"'$([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#I_#P") "$PWD")'
PS1='$ '

@erikw
Copy link
Owner

erikw commented Oct 25, 2012

Alright a3fa89c and I mark this as solved :-)

@erikw erikw closed this as completed Oct 25, 2012
This was referenced Dec 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants