Most active commenters
  • m000(3)
  • deathanatos(3)
  • wocram(3)
  • dajt(3)

←back to thread

457 points benoitg | 28 comments | | HN request time: 0.86s | source | bottom
1. m000 ◴[] No.44367731[source]
I would be very curious to see an age demographic chart of people using e.g. Starship.

Personally, over time, I have stopped caring too much about prompt customization. I concluded that, no matter how carefully you curate your prompt, 90% of the information shown will be irrelevant 90% of the time*. After a while, your brain will start perceiving this as visual clutter and filter it out, to the point you may even forget the information is there, right in front of your eyes.

And for the things that matter, you probably need more details than any prompt can show you. E.g. are there changes in your git branch? Ok there are, good to know, but which files have changed? Just knowing that there are changes is not really actionable information. You need to run additional commands to get actionable details.

* the numbers are completely arbitrary, but you get the picture

replies(12): >>44368415 #>>44368447 #>>44368864 #>>44369236 #>>44369278 #>>44370150 #>>44370843 #>>44371011 #>>44371393 #>>44373149 #>>44376069 #>>44385108 #
2. bityard ◴[] No.44368415[source]
I think we can generalize this into the overall computing environment. When I was younger, I was that kid building my whole OS from source via Gentoo, with all the CPU-specific flags and optimizations. I had a very detailed window manager configuration (fwvm2 maybe?), a .bashrc full of aliases and functions for every occasion. And yes, a custom prompt.

I think these kinds of over-optimization rabbit holes are a good learning experience, but I compare it to woodworking. A woodworker just starting out will spend most of his/her time building or refining the tools they need, learning techniques, coming up with ideas/designs and testing them, etc. But eventually the point comes where you have to get Real Work done and the tools and jigs have to wait until the weekend.

Linux is still my favorite desktop OS, but these days I just run Debian and KDE because "free time" is not a thing I have anymore and I care more about getting things done than having the most optimal computing experience.

replies(1): >>44369070 #
3. deathanatos ◴[] No.44368447[source]
As a counterpoint, one of the most useful customizations I've made to my prompt is to emit the exit status of the prior command. Knowing that something failed is a useful signal, esp. when sometimes the thing failing just fails to emit any output that indicates that it failed.

I only emit it if the prior command fails, too, so it doesn't clutter things the 90% of the time things are working.

  » true
  » false
  (last command returned 1.)
  » 
I also translate signals, so I get "last command exited on SIGSEGV", or so.

It's also useful the other way: when a program emits and error and exits with "success".

replies(4): >>44369265 #>>44369378 #>>44369845 #>>44373145 #
4. rcarmo ◴[] No.44368864[source]
I’m “very senior” (as in decades of _Unix_ use senior) and I like it in minimal mode because it’s just so much less hassle than all the other zsh stuff I had been using for a couple of decades. Not sure if you expected replies to be full of all the JavaScript kids that use emojis in logging messages, but apologies if so :)
replies(2): >>44369400 #>>44372289 #
5. skydhash ◴[] No.44369070[source]
I still have free time, my shift to default config and stable software was caused by how many workfkow changes for no reason I could stomach. I rarely need the latest features. Getting things to work and expecting to stay working for a while is the basic premise of computing.
6. Twirrim ◴[] No.44369236[source]
I'm senior, been working in the industry for closing on 25 years now, majority of that dealing with *nix systems of various descriptions. I usually avoid anything "ohh shiny".

I've tried prompts in the past, and they mostly annoyed me, or never showed me useful information. I've been a happy starship user for several years now. I've got the config tweaked so that it only shows me things I specifically care about. It's lightning fast.

7. __float ◴[] No.44369265[source]
I like the exit code feature a lot; Starship does that with my config in a subtle color change.

My shell customization is largely throwing Starship in (so it looks the same on all the machines I use -- Ubuntu servers at work, macOS at home, nixOS/Fedora/etc. servers for personal use.) and a starship.toml I wrote once and now leave alone.

8. Twirrim ◴[] No.44369278[source]
I'm senior, been working in the industry for closing on 25 years now. I usually avoid anything "ohh shiny".

For most of my career I used a very simple PS1:

    export PS1="\[\033[1;32m\][\t \u@\h \w]\\$\[\033[0m\] "
timestamp, who I am, what box I'm on, where I am.

I've tried prompts in the past, and they mostly annoyed me, or never showed me useful information. I've been a happy starship user for several years now. I've got the config tweaked so that it only shows me things I specifically care about. It's lightning fast.

9. m000 ◴[] No.44369378[source]
That's useful indeed. Did you custom-code it, or is it e.g. an ohmyzsh plugin or something?
replies(1): >>44373577 #
10. m000 ◴[] No.44369400[source]
It's always nice to have an impromptu HN poll. We may have been missing and didn't know :)

And now that you mention it, next year will be my 30th Unix-versary. Time flies... Still not a greybeard though.

replies(1): >>44372493 #
11. tclancy ◴[] No.44369845[source]
Oh, how do you automate that? I usually add a "& say done | say failed" to long-running tasks if I remember to do it.
replies(2): >>44370766 #>>44373575 #
12. inejge ◴[] No.44370150[source]
> Personally, over time, I have stopped caring too much about prompt customization.

For a while, I tried a couple of Christmas tree prompts which included all kinds of condensed Git status and other bells and whistles, but eventually tired of them and settled on:

- Exit status of the previous command, if nonzero.

- Current time, HH:MM, 24 hour format.

- user@host, red if euid 0, green otherwise.

- Current directory, shortened if the path has three or more elements, with home directory recognition.

- Current directory, full path, echoed as hardstatus and hence appearing in the terminal window title.

- The name of the current branch if within a Git repo.

- Prompt character, dollar/hash sign.

All those elements are meaningful to me, inasmuch as I can quickly orient myself using that information and explore further if I notice anything out of the ordinary.

I'm pretty sure that megaprompt programs like Starship could produce the above, but I like obtaining a familiar prompt with a minimum of external dependencies, and so have written it all in Bash, then ported to Zsh and various Korn shells, which was quite tricky. It probably wouldn't work on Xenix 286, but anything newer has a fighting chance.

replies(2): >>44371819 #>>44376109 #
13. teo_zero ◴[] No.44370766{3}[source]
In bash, it's enough to remember that $? expands to the exit code of the previous command, and $((x)) evaluate x as an integer expression, including the ternary operator x?y:z.

For example the following prints the exit code in green if zero, in red otherwise:

  PS1='\[\e[$(($??31:32))m\]$? \[\e[39m\]'
14. natebc ◴[] No.44370843[source]
26 years with Linux. I use starship but primarily because I administer multiple kubernetes clusters and having the kube context staring me in the face is critical. I don't adjust the default config more than just making sure the kube bits are enabled.

That said my vimrc is 2 lines that i can configure manually, I don't touch bash config from Debian defaults and my fish config is vanilla save for a handful of functions because I'm a lazy. My ssh config is pretty heavily customized but mostly around what keys/usernames to default to for which hosts (see previous about lazy).

15. NelsonMinar ◴[] No.44371011[source]
Starship was the first time I meaningfully changed my shell prompt in nearly 30 years.
16. Merad ◴[] No.44371393[source]
I've been coding for 20 years, I very much like having git info in the prompt. Even if it doesn't tell me everything (and it often doesn't) it _is_ a reminder that I have uncommitted changes, or haven't pushed yet, or a stash that I might have forgotten about.

I played with Starship for an hour this morning - the joys of 50 person planning meetings - but ultimately uninstalled it. I did like some of its options like command timing and success/error, but all the tool versions ultimately just felt like noise. Not worth the effort to maintain a complex custom config to trim it down to what I'd want.

replies(1): >>44373137 #
17. eddd-ddde ◴[] No.44371819[source]
I'm 90% sure what you described is fish default prompt.
18. dmd ◴[] No.44372289[source]
Same here. I’ve been using Unix of some flavor or another since 1989 and generally prefer minimalism and simplicity - but I also prefer “opinionated good defaults”, and starship gives me that. (I’ve even switched to Fish, because it does well with no config absolutely basic table stakes stuff OOTB that bash/zsh need a ton of garbage for.)
19. _kb ◴[] No.44372493{3}[source]
30 is not that long in Unix time. Or did you mean your 946708560th?
20. wocram ◴[] No.44373137[source]
Choosing which segments to show is the main the to configure. It's even one of the preset example to hide versions: https://starship.rs/presets/no-runtimes

I agree there's a lot of noise that seems to be there by default.

21. wocram ◴[] No.44373145[source]
This and command duration if the command ran longer than 10 seconds are the most useful things to add.
22. wocram ◴[] No.44373149[source]
I hope to not age out of trying out new tools other people like!
replies(1): >>44376126 #
23. deathanatos ◴[] No.44373575{3}[source]
https://github.com/thanatos/dotfiles/blob/master/shell/zsh/p...

That was my prompt when it was written in zsh. Sort of like TFA, I've since moved to Rust:

https://github.com/thanatos/dotfiles/blob/master/zsh-prompt-...

I think (if I am reading TFA's code right) unlike the article, I'm using zsh's module functionality, so the Rust here is a .so that is loaded directly into the shell's memory. (I.e., I do not have to fork/exec a separate Rust bin to compute the prompt, though I think zsh might fork-but-not-exec for computing the prompt itself.)

The latter is, of course, somewhat more complicated in some senses. (Esp. on macOS, which work forces me to use, where dlopen(2) is just utterly insane.)

24. deathanatos ◴[] No.44373577{3}[source]
I custom coded it. (Details: https://news.ycombinator.com/item?id=44373575)
25. dajt ◴[] No.44376069[source]
For most of my nearly 40 years in work I had PS1='$ ' and PS2='> '.

A few years ago I progressed to having the current directory in there.

The thought of running a child process to create my prompt every time I hit enter doesn't feel right.

26. dajt ◴[] No.44376109[source]
That does look pretty good. I wouldn't bother with the time but I like the rest of it.
27. dajt ◴[] No.44376126[source]
You won't. I tried uv the other day. But I'm too old to want to run a child process just to draw a prompt.

I should know what git branch I'm in, and if I don't it's a simple command away.

28. deafpolygon ◴[] No.44385108[source]
This is me. All I need to know is my current directory, and the status in color of my last command (red for failed, green for zero [my prompt starts with ->]). That's it.

It also gives me the current branch in a directory that has git, just so I'm sure of what I'm working on-- but most of the time that's handled by whatever editor I'm using.