lvv / git-prompt Goto Github PK
View Code? Open in Web Editor NEWbash prompt with GIT, SVN and HG modules
Home Page: http://volnitsky.com/project/git-prompt
bash prompt with GIT, SVN and HG modules
Home Page: http://volnitsky.com/project/git-prompt
GIT Prompt for BASH Screenshots and docs are at: http://volnitsky.com/project/git-prompt
Hi,
I never enter git status 'Changed but not updated:', can you give more comments?
I only see git status ' Changes not staged for commit:', which confuse me.
Thanks,
Steven.l
On the official website, the GitHub link at the top just below the title does not point to the correct repo: lvv/scc
instead of lvv/git-prompt
.
I see there's even a TODO inside the code. Do you have any ideas how to fix these yet @lvv?
Thanks.
I have cloned the bash-completion repository.
when I move the dir repository I get
$ cd bash-completion
bash: eval: line 68: syntax error in conditional expression
bash: eval: line 68: syntax error near `untracked_files[${#untracked_files[@]}]=""test/"'
bash: eval: line 68: ` [[ " ${untracked_files[*]} ${modified_files[*]} ${added_files[*]} " =~ " "test/ " ]] || untracked_files[${#untracked_files[@]}]=""test/"'
new git ( in my case 1.8.5.1 ) changed git status output, the '# ' prefix is gone
So I have to use now:
eval " $(
git status 2>/dev/null |
sed -n '
s/^On branch /branch=/p
s/^nothing to commi.*/clean=clean/p
s/^Initial commi.*/init=init/p
s/^Your branch is ahead of \(.\).\+\1 by [[:digit:]]\+ commit.*/freshness=${WHITE}↑/p
s/^Your branch is behind \(.\).\+\1 by [[:digit:]]\+ commit.*/freshness=${YELLOW}↓/p
s/^Your branch and \(.\).\+\1 have diverged.*/freshness=${YELLOW}↕/p
'
)"
sed doesn't understand s/^(# )?On branch /branch=/p
so I fear the change has to check the git version
Love you script.. I mean prompt.
It only it could work on msysgit...
Since I use a hardstatus that shows all the screen windows already, I don't need to see it on the prompt, so for now I set tty to empty in git-prompt.sh, but it'd be good to get a variable for it in the conf.
consider the following output generated by a git status
# new file: jPDF_Test_V7/src/testdocs/ReleaseNotes.15.pdf
# new file: jPDF_Test_V7/src/testdocs/ReleaseNotes.pdf
# new file: "jPDF_Test_V7/src/testdocs/Ringkj\302\257bing_01.pdf"
the last line will make git prompt fail
-bash: eval: line 1033: syntax error in conditional expression
-bash: eval: line 1033: syntax error near `added_files[${#added_files[@]}]=""jPDF_Test_V7/"'
-bash: eval: line 1033: ` [[ " ${added_files[*]} " =~ " "jPDF_Test_V7/ " ]] || added_files[${#added_files[@]}]=""jPDF_Test_V7/"'
I'm a bit ignorant on the topic, but figured i'd post this anyway. git-prompt dosn't seem to be compatible with autojump (http://github.com/joelthelion/autojump), because it overwrites PROMPT_COMMAND.
I've tried guessing about how to fix it:
PROMPT_COMMAND_FUNCTION=prompt_command_function
PROMPT_COMMAND="$PROMPT_COMMAND_FUNCTION && ${PROMPT_COMMAND:-:}"
However my limited knowledge of PROMPT_COMMAND leaves me wanting.
Some commands (e.g. "ls *" in a directory with many files) produce very long command lines. git-prompt tries to set the title of the window to the currently-executing command line, and rxvt-unicode doesn't work correctly when the line is about 2000 or more characters long. (It puts the part after the first ~2000 characters into the terminal, which is very ugly.)
I think the solution is to truncate the command line before trying to use it as the terminal title. E.g.:
set_shell_label() {
command_line="${@}"
truncated_command_line=${command_line:0:200}
xterm_label() { echo -n "�]2;${truncated_command_line}�" ; } # FIXME: replace hardcodes with terminfo codes
[...]
This truncates the command line to 200 characters before sending it to the terminal.
Also, in exploring this problem I noticed that disable_set_shell_label
doesn't work correctly for me. I fixed this problem by declaring disable_set_shell_label
and enable_set_shell_label
to have the "trace" attribute in bash. This is done by adding:
declare -ft disable_set_shell_label
and
declare -ft enable_set_shell_label
after the definitions of those functions in git-prompt.sh
.
P.S. git-prompt is great; thanks for developing it!
I have problems with this command
$ cd -
bash: cd: OLDPWD not set
I am running the same script on OSX and CentOS 55: It's a colorization issue.
On CentOS, the following prompt
(M=f7e6a) [email protected] ~/test#
Will show =f7e6a black (it shows white on osx). Since my terminal has a black background, it appears invisible.
I tried changing a few settings with no success.
Please advise,
Thank you
(reinmar=fa04877) piotrus@dragonus /www/repo/dt/core> grep -R getCustomData *
1 (reinmar=fa04877) piotrus@dragonus /www/repo/dt/core>
Hi, git-prompt is really cool, but one thing is missing - option for switching off displaying exit code in prompt. I don't like it, but I haven't found how to get rid of it :).
BTW. Why there's no link to this github project on http://volnitsky.com/project/git-prompt/ ?
Thanks,
Piotrek.
Ian Bicking's virtualenv project amends the prompt when you select a virtualenv. git-prompt erases or blocks this content:
old::
me@myhost $ . venv/bin/activate
(venv) me@myhost $ deactivate
me@myhost $
git-prompt::
(D) [email protected] ~> . venv/bin/activate
(D) [email protected] ~> deactivate
(D) [email protected] ~>
when I use git-prompt in a ubuntu, this is the appearance of the prompt
(M )
don't see the hash.
the characteristics of my system
$ git --version
git version 1.7.1
$ bash --version
GNU bash, versión 4.1.5(1)-release (x86_64-pc-linux-gnu)
$ cat /etc/*ele*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"
Below cut-n-past shows "cups/" in prompt. It shouldn't becase cups is from parent dir.
git status
On branch master
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: ../cups/printers.conf
modified: ../cups/printers.conf.O
modified: ../cups/subscriptions.conf
modified: ../cups/subscriptions.conf.O
no changes added to commit (use "git add" and/or "git commit -a")
(M=78a58 cups/) root /etc/portage>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.