Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
An adaptive prompt for Bash and Zsh (github.com/nojhan)
68 points by nojhan on April 20, 2013 | hide | past | favorite | 21 comments


That is way too much information for me personally (I am distracted enough as it is, and I believe real-time data like battery level belongs in your menu bar, not the terminal) but I can see how it would be useful to some.


That's amusing, because I've started liquidprompt for this very specific reason: I was constantly missing the battery notification icon. Time seems to have trained my brain not to look at this screen area. Fortunately, with liquidprompt alerts are spoting just where I look at, and only when necessary.


Yeah, Conky or similar status bar window manager widget is better for me for the real-time data (battery, cpu temp, date/time, etc.); too much to visually parse otherwise.

Definitely some nice features in here at first glance (colored directory perms and colored root vs. normal user are real nice-to-haves for example).


If you look under features configuration there's options for turning a lot of it off. I agree that the majority probably isn't useful unless you're running without a window manager for some reason, but even just the VCS info is pretty neat.


Window manager doesn't necessarily imply menubar. For example, with xmonad, you don't have a menubar unless you install xmobar. This could be an alternative to that, though admittedly that's a really obscure use case.

For me, most of this I don't want, and some I already have (git repo stuff), but some is new and potentially really convenient, especially the stuff for number of sleeping/background jobs.


Some time back I created my own ZSH prompt as I wanted something fast and minimal, where most others were too feature rich. It's also a good base if you want to create your own. https://github.com/sindresorhus/pure


what version of ZSH are you using? I'm having issues installing this on Ubuntu where the metadata commands aren't executing and are instead printed as

  $vcs_info_msg_0_`git_dirty` $username `cmd_exec_time`


Latest - 5.0.2


Interesting. I installed 5.0.2, removed anything that would be interfering with my .zshrc and still have the same problems.


This is much more appealing to me.


This has nothing specific to OS X, unsure to why OS X is in the title.


To be honest, just because I've tried to pass this link in hackernews several times without success, with different combination of keywords/users.

I was a little bit shameful at the beginning, but the overwhelming success (from the perspective of this very little software: github stars * 2) is interesting.

It seems that some keywords are more efficient than others. Let's consider this practice as social engineering.


Some admin should fix it: it's for Bash and ZSH.


I use PS1='$ ' on the local machine and 'foo$ ' if I've ssh'd to foo. I prefer this because: the location of the cursor is more fixed, it doesn't wander across the columns as the environment changes, so my eye finds it more quickly; I've a decent amount of line left before it wraps at the end of the terminal, and I often type 100+-character pipelines on the fly; a couple of taps of Enter gives almost blank lines that logically separate when needed. 


Solution to that: multi-line prompts. First line with lots of info, second line just '$ '. Or RPROMPT if you are using zsh ([...] RPROMPT parameter. If this is set, the shell puts a prompt on the right side of the screen.)


That wouldn't give the sequence of almost-blank lines I find most helpful. It would also merge the first, long, line of the prompt with the tail of the previous command's output.


I've been using (a slightly modified version of) https://github.com/dotcode/multi-shell-repo-prompt for a while now. Conveys what I consider to be relevant, anyway.


A bit busy for me. I stick to time@host:dir and then a symbol for security level (root, admin, role, personal, daemon, test). Thinking about doing different color schemes for different hosts, too.


zsh has RPROMPT, which displays on the right of your prompt and gets overwritten if you write a long command. I use it to show the last command's exit status and my current git branch, effectively without taking up space.


Love it, thanks for sharing!


Not my screenshot (and I use Tango with Konsole) but I like the agnoster+zsh combo.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: