Live data from Hacker News

A heads up display for git

github.com

41–50 of 62 posts

Re: A heads up display for git

#43
I like the appearance of prompts like this, and I've tried them a few times, but I always find myself turning them back off the first time I cd into a large git repository and have to wait a full second or two for the prompt to return. git is fast, but the prompt needs to show up instantly, and git isn't instantaneous on repositories the size of Linux or Chrome.

Re: A heads up display for git

#45
post #40

If you like this, I recommend oh-my-zsh [1] or prezto[2], both have themes for things like this. [1]: https://github.com/robbyrussell/oh-my-zsh [2]: https://github.com/sorin-ionescu/prezto

I personally use the agnoster theme from oh-my-zsh. With the required powerline-patched font, its very readable and has enough git info to keep me informed without taking up too much space:

https://gist.github.com/agnoster/3712874

Re: A heads up display for git

#47
post #17
post #9

I use a modified version of mislav's git prompt https://gist.github.com/mislav/1712320 which is pretty minimal but usually enough for me. For when I have to wrangle lots of files at once (like during interactive rebase to clean up history before push) I have a git watch alias that shows a high-level overview of changes that refreshes with inotify: [alias] watch = "!clear;inotifywait --quiet -mr -e modify,move,create,…

How would this need to be changed to work on osx?

This works on OSX:

  while :; do clear; git status --short; git --no-pager diff --shortstat; sleep 2; done

Re: A heads up display for git

#48
post #19

Earlier quoted context omitted.

I added logic to mine to check for a .noprompt file and disable the git part of my bash prompt as I generally want it enabled, but a few large repos are too slow with it. You could do something similar, I'm sure.

I wonder if an asynchronous approach could be implemented. Like starting the git status and the likes in a separate process and killing it after a certain timeout if it takes too long. While I like that there is a .noprompt feature it's mainly a workaround. Maybe there could be a toggle feature where the user can turn on and off the git prompt on demand, wouldn't be hard to implement. Maybe I will start hacking on it…

It can be done, and it actually works quite well. See this post for a demo + code: http://www.anishathalye.com/2015/02/07/an-asynchronous-shell...

Re: A heads up display for git

#49

I like the appearance of prompts like this, and I've tried them a few times, but I always find myself turning them back off the first time I cd into a large git repository and have to wait a full second or two for the prompt to return. git is fast, but the prompt needs to show up instantly , and git isn't instantaneous on repositories the size of Linux or Chrome.

Have you thought about using an asynchronously rendered prompt?

Re: A heads up display for git

#50

I like the appearance of prompts like this, and I've tried them a few times, but I always find myself turning them back off the first time I cd into a large git repository and have to wait a full second or two for the prompt to return. git is fast, but the prompt needs to show up instantly , and git isn't instantaneous on repositories the size of Linux or Chrome.

Have you thought about using an asynchronously rendered prompt?

That sounds disconcerting and distracting; I don't want my prompt to change while I'm typing a command. If I already have a command prompt, I can type "git status" easily enough.

Also, how would that work?

Post reply on HN