4 ms·
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
by JoshTriplett 11y ago
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.
- anishathalye 11y agoHave you thought about using an asynchronously rendered prompt?
- JoshTriplett 11y agoThat 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?
- anishathalye 11y agoIt's not that bad actually - I've been using one since February. Here's a demo (+ code): http://www.anishathalye.com/2015/02/07/an-asynchronous-shell-prompt/ http://www.anishathalye.com/2015/02/07/an-asynchronous-shell...
- JoshTriplett 11y agoAh, I see. Interesting zsh magic, and the right-prompt mechanism makes it more palatable. Two issues, though. First, I use bash. Second, and more importantly, you're using the same temporary file for all shells, so the prompts from different shells (in different working directories) will overwrite each other.
- anishathalye 11y agoYeah, not sure if/how to do this in bash :P Yeah, I thought about using a different temp file per shell, and I did use that for some time, but that got annoying when shells didn't exit gracefully and clean up the temp file. I don't actually care about race conditions (okay, the wrong prompt may be displayed once, big deal), and it doesn't actually happen in real use because of the way timing works out.