Ramblings of an aging IT geek
← Ramblings of an aging IT geek
tooling

a prompt that earns its space

Trimming my shell prompt down to the four things that actually change my next command, and dropping everything that doesn't.

A terminal showing a shell prompt

I spent an embarrassing amount of time over the years making my shell prompt prettier, and almost none making it useful. There's a difference. A pretty prompt shows you the time, the battery, a little segment for the weather, and three Nerd Font icons you stopped noticing on day two. A useful prompt shows you the things that change what you're about to type, and nothing else.

So I cut mine back to four. The git branch, because I commit to the wrong one otherwise. A dirty-state marker, so I know there are uncommitted changes before I rebase over them. The exit code of the last command, but only when it's non-zero, because a green nothing is just noise and a red 127 is a clue. And the current directory, shortened, because I am not above running rm -rf in the wrong place.

That's it. Everything I removed, I removed because it never once changed my next keystroke. The clock didn't. I have a clock. The hostname I kept only on remote boxes, where confusing two machines is a genuinely expensive mistake, and dropped locally where it never is.

I moved to Starship to do it, mostly because it makes "show this segment only when it's relevant" trivial instead of a wall of shell escapes I'd be too scared to touch in a year. The git status, the non-zero exit code, the language version when there's a project file present: all there when they matter, all gone when they don't. The prompt got shorter and I got faster, which is the opposite of what I expected from spending an evening on something this small.