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

the prompt earns its keep

Trimming a shell prompt down to the four things I actually look at, and dropping the rest.

A mechanical keyboard lit by a terminal

I spent years carrying a prompt that told me everything. Hostname, full path, exit code, git branch, dirty flag, ahead/behind, the time, a battery glyph. It looked impressive in a screenshot and was useless to read, because when the prompt says everything it says nothing. My eyes slid straight off it.

So I cut it back to the four things I actually act on. Am I on a host that isn't my laptop? Then colour the prompt. Did the last command fail? Then show the exit code, otherwise hide it. Is this a git repo with uncommitted changes? One dirty marker, no branch arithmetic. And the working directory, but shortened to the last two segments unless I'm at a repo root.

Everything else is a keystroke away. I don't need the time in my prompt, I have a clock. I don't need ahead/behind on every line, I have git status for the rare moment I care.

The real win was the failure case. With the exit code suppressed on success, a non-zero status now stands out instead of blending into the noise. I notice when something quietly returned 1, which is exactly when I want to notice.

It's a small thing. But the prompt is the one bit of UI I read thousands of times a day, and making it boring on purpose was one of the better afternoons I've spent this year.