Live data from Hacker News

Git info in your ZSH Prompt

briancarper.net

11–20 of 27 posts

Re: Git info in your ZSH Prompt

#11
I love that vcs_info works with more than just git. Having my prompt tell me what VCS I'm under (even knowing the difference between git and git-svn) and what branch I've got checked out helps me mentally switch gears as soon as I cd into a directory.

Re: Git info in your ZSH Prompt

#12
post #2

I've been really digging oh-my-zsh recently for extending zsh, comes with a great plugin architecture and all sorts of cool shit: http://github.com/robbyrussell/oh-my-zsh

Beat me to the punch... Oh-my-zsh ftw. Robby Russell has a great blog about rails development too. http://www.robbyonrails.com/

Re: Git info in your ZSH Prompt

#13

Wow, am I the only person who prefers a shell prompt of just "$ "? I have a bunch of abbreviations for common git commands, though, so I guess it balances out.

You just might be. ;-)

I have git status in my prompt but also use short shell aliases. If anyone's curious:

http://github.com/samsonjs/config/blob/master/zsh/zshrc#L230...

Re: Git info in your ZSH Prompt

#14

Wow, am I the only person who prefers a shell prompt of just "$ "? I have a bunch of abbreviations for common git commands, though, so I guess it balances out.

You're not- I can't stand waiting 3-5 seconds every time I hit enter, just so I can have a more verbose prompt that tells me things I already knew.

Re: Git info in your ZSH Prompt

#15

Wow, am I the only person who prefers a shell prompt of just "$ "? I have a bunch of abbreviations for common git commands, though, so I guess it balances out.

You're not- I can't stand waiting 3-5 seconds every time I hit enter, just so I can have a more verbose prompt that tells me things I already knew.

The one I wrote, for Bash, uses SIGALRM (via the Time::HiRes perl module) to time out after half a second: http://github.com/paulbaumgart/git-situational-awareness

Re: Git info in your ZSH Prompt

#16

Wow, am I the only person who prefers a shell prompt of just "$ "? I have a bunch of abbreviations for common git commands, though, so I guess it balances out.

I like a timestamp so that I know:

(1) How long the last command took (approx, as there's time between the prompt showing and me putting in a command)

(2) How long ago I ran the last command in a given shell window

Re: Git info in your ZSH Prompt

#17
post #6

Note also that there's a more feature complete version that accomplishes the same tasks in the contrib directory of git ( http://git.kernel.org/?p=git/git.git;a=blob;f=contrib/comple... ). It's implemented in bash but I use it with almost no modification with the Korn shell.

This makes me very happy, thanks!

Re: Git info in your ZSH Prompt

#18

Wow, am I the only person who prefers a shell prompt of just "$ "? I have a bunch of abbreviations for common git commands, though, so I guess it balances out.

Nope, me too. I can see maybe using a prompt like this temporarily, or putting this info in an XTerm's title, but I spend most of my time on the command line and really don't want crap like this distracting me.

My prompt on localhost is always "$ " or "# ", but I add user and host on remote machines to avoid making any big mistakes on the servers I manage.

Re: Git info in your ZSH Prompt

#19

Earlier quoted context omitted.

You're not- I can't stand waiting 3-5 seconds every time I hit enter, just so I can have a more verbose prompt that tells me things I already knew.

The one I wrote, for Bash, uses SIGALRM (via the Time::HiRes perl module) to time out after half a second: http://github.com/paulbaumgart/git-situational-awareness

It would be cool to do the opposite as well, don't start checking the fancy vcs stuff until 1/2 second after the prompt is loaded.

Re: Git info in your ZSH Prompt

#20
post #18

Wow, am I the only person who prefers a shell prompt of just "$ "? I have a bunch of abbreviations for common git commands, though, so I guess it balances out.

Nope, me too. I can see maybe using a prompt like this temporarily, or putting this info in an XTerm's title, but I spend most of my time on the command line and really don't want crap like this distracting me. My prompt on localhost is always "$ " or "# ", but I add user and host on remote machines to avoid making any big mistakes on the servers I manage.

Come to think of it, I do actually keep that info around, I just put it in the status line* in tmux or dwm, rather than cluttering my shell prompt with it. I guess that's a different post, though!

* Mine currently says:

    3.1 pra |  0:ksh  1:top  2:ksh  4:ksh- 5:w3m*                                                        |   . 1.45, 1.57, 1.01 . 2010-10-07 23:07
which has system load, time, battery (on laptops), etc. "pra" = "pranaferox", my desktop. (I usually have a lot more shells open than that, but I turned everything off while installing a new light in the ceiling earlier.)
Post reply on HN