GithubHelp home page GithubHelp logo

Comments (8)

Pewpewarrows avatar Pewpewarrows commented on August 29, 2024

Ended up stumbling upon a solution this morning. There's a bash variable called PROMPT_COMMAND, that if set, will execute every time a prompt appears (whether it's after a cd or any other command on the terminal).

By placing this in my .bash_profile or .bashrc, I was able to get vcprompt to always show the latest directory info:

update_prompt() {
    export PS1="$(vcprompt) blah blah blah"
}
PROMPT_COMMAND=update_prompt

Anything that I needed to update every time a new prompt appeared, I threw into that update_prompt function, such as looking for the $VIRTUAL_ENV variable being set, using a custom vcprompt format, etc.

I don't know if the PROMPT_COMMAND shenanigans is only a problem because of some system configuration of mine, or whether this is a universal issue that the docs just failed to mention. In which case, an updated README would be nice :)

from vcprompt.

djl avatar djl commented on August 29, 2024

Weird. I noticed this happening myself while I was working on the README overhaul. Testing it again now, I can't get it to happen again.

I'm fairly certain it's my crappy install procedure. I'll poke around some more and update the README if I find anything.

from vcprompt.

djl avatar djl commented on August 29, 2024

Updated the instructions in 81b13b6. The problem seemed to be the recursive use of $PS1.

Try that. It should be fixed now :)

from vcprompt.

vbajpai avatar vbajpai commented on August 29, 2024

I had the same issue.

@xvzf: the updated instructions didn't help me.

@Pewpewarrows: the PROMPT_COMMAND trick worked for me

from vcprompt.

djl avatar djl commented on August 29, 2024

That's what I get for not using bash :)

I'll update the instructions later.

from vcprompt.

djl avatar djl commented on August 29, 2024

Oh! I found a simpler way to do it. Just escape the dollar sign:

export PS1="\$(vcprompt) blah blah blah"

@vbajpai, @Pewpewarrows: can you try this way and let me know if it works?

from vcprompt.

vbajpai avatar vbajpai commented on August 29, 2024

On Jul 14, 2011, at 8:05 PM, xvzf wrote:

I have been doing that actually all this while.

from vcprompt.

djl avatar djl commented on August 29, 2024

According to this page that should be working. Since it works for me in a bunch of different versions of bash, I'll settle on those instructions.

from vcprompt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.