Live data from Hacker News

Starship: A minimal, fast, and customizable prompt for any shell

starship.rs

161–170 of 216 posts

Re: Starship: A minimal, fast, and customizable prompt for any shell

#161

Earlier quoted context omitted.

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 comm…

Oh, how do you automate that? I usually add a "& say done | say failed" to long-running tasks if I remember to do it.

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\]'

Re: Starship: A minimal, fast, and customizable prompt for any shell

#162
post #35

Earlier quoted context omitted.

Starship is very fast, taking only a couple of milliseconds to gather the data (and you can easily configure it to minimise what it'll spend time gathering). It's night and day compared to other ones I've tried, where the hundred millisecond-ish delays annoyed me.

Depends a lot on the system. I tried using it on Windows via MSYS2, and it seems like some Windows overhead (maybe process startup?) was causing Starship to slow it all down to a crawl. Disabling a few of the addons helped but didn't fix it. In the end I stopped using it.

Windows' filesystem performance for tools that expect Unix is abysmal, and it gets drastically worse in most corporate environments because endpoint security software hooks into the filesystem drivers to instrument all file access.

Git-aware prompts can't be recommended on Windows, imo.

Re: Starship: A minimal, fast, and customizable prompt for any shell

#163
post #109

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 for…

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).

Re: Starship: A minimal, fast, and customizable prompt for any shell

#164
post #109

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 for…

Starship was the first time I meaningfully changed my shell prompt in nearly 30 years.

Re: Starship: A minimal, fast, and customizable prompt for any shell

#165
I started using Pure prompt since I'm only ever using zsh and it seemed to cut down a lot on the setup required, I do have to spend like 15-20 mins on a new computer to get everything working as expected but once it gets going, it feels like the best mix of customization and speed.

Re: Starship: A minimal, fast, and customizable prompt for any shell

#166
I have several use-cases / problems I solve with my prompt:

- See current git branch (to not mistakenly work or commit into the wrong branch)

- See git has changes (to stash them before switching branches)

- See the current language/engine version (like go v1.24.2, because i use tools like gvm, sdk, nvm or rustup to switch version in projects and i want feedback that i have the correct/expected language version enabled)

- See that i am on my local or a remote machine and k8s context

That's mostly it. Of course, I can do this by writing my own prompt, but I found out that Starship does this for me, basically out of the box, on any machine and terminal, in a very nice-looking way. Also, I am not a fan of fancy-looking prompts, so visually, Starship fits best for me.

Re: Starship: A minimal, fast, and customizable prompt for any shell

#168
post #109

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 for…

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.

Re: Starship: A minimal, fast, and customizable prompt for any shell

#169
I've always liked powerlevel10k, or its equivalent tide for fish shell, which I much prefer over bash/zsh. Its fast, async, has everything you need, and is much easier to configure.

I've always wondered why someone doesn't just bundle a nice looking shell prompt with common nerd fonts and make it the default in a single package you can install.

Re: Starship: A minimal, fast, and customizable prompt for any shell

#170
With or without starship, one problem I have with zsh prompts is that when I press Enter, there is still a visible delay where for a fraction of a second, the cursor moves to the beginning of the next line.

This makes a nasty "flashing" effect.

If I keep Enter pressed, the cursor is permanently visible at offset 0 in the lowest line.

If the prompt is ultra-fast (e.g. plain root shell prompt on zsh), it happens less (e.g. only 50% of cases), but as soon as the prompt does anything, it's very visible.

I observe this with many terminals (gnome-terminal, wezterm, kitty, alacritty, xterm).

The only terminal I tried that doesn't have this problem is urxvt, where it looks perfect.

Video repro: https://nh2.me/flashing-cursors-on-newline.mp4

Why, and is there a way around it for those other terminals?

Post reply on HN