jimeh / git-aware-prompt

Display current Git branch name in your terminal prompt when in a Git working directory.
Creative Commons Zero v1.0 Universal
2.16k stars 340 forks source link

Getting some weird prompts. #20

Closed shri3k closed 9 years ago

shri3k commented 9 years ago

Hey guys, Not sure if this is just me but can anyone confirm if it's working for them or it's just me? I'm using Ubuntu 14.10 and it was working fine but it just stopped working one day. I don't know what I did. I have cloned git-aware-promp in .bash directory. The following lines of codes are at the end of my.bashrc file

export GITAWAREPROMPT=~/.bash/git-aware-prompt
source $GITAWAREPROMPT/main.sh
export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]@\h\[\033[00m\]:\[\033[01;34m\]t_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ ""]]]"

but I get this:- weird-prompt That's the prompt I get without even typing anything. I'm not super good at changing prompt shells. :cry:

jimeh commented 9 years ago

Hey, I believe it's you. You've got a couple of typos in your PS1 line :)

Try changing it to this:

export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]@\h\[\033[00m\]:\[\033[01;34m\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "

Or if you want to include your username and current directory in the prompt, here's the suggested colorized PS1 line from the readme:

export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
shri3k commented 9 years ago

I see what's going on. For some reason when I paste in vim it's adding this "]]]" extra characters. I know I had copied and pasted the PS1 from the readme file. Thanks for confirming @jimeh :smiley: