Live data from Hacker News

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

starship.rs

81–90 of 216 posts

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

#81
post #72

Earlier quoted context omitted.

You don't need to know what branch you're on before running commands? I cant tell you the number of times ive been on the wrong branch executing stuff.

I'm highly aware of which branch I'm on. Because it's because I don't use any scripts or automation that switches branches; I only ever switch branches manually so I have that awareness.

I only switch branches manually too, but I work in many repos and come back to stuff after days sometimes.

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

#82
I tried starship a few years ago and found it too "extra" and sluggish. I'm sure it may have improved in this time, but I ended up sticking with the excellent Hydro[0], only for fish though.

It's very minimal while having useful features: - exit codes, even for pipelines - git branch, status (displayed as a dot if your tree is dirty) and ahead/behind counts - command execution time (if above some configurable threshold) - truncated/minified $CWD, always maintaining the git root's name (I sometimes like it, sometimes don't; fortunately, it's very easy to change) - current vi-like mode (I don't use that)

It's very fast and async (prompt repaints don't block your input or running commands), and totals 132 lines of fish (according to cloc[1]). It's also very customisable through variables, which can be declared as universal to instantly change on all sessions you have open.

If you're on fish and like this feature set, definitely give it a shot, or at least look at the code as a base for a bespoke prompt :P

[0]: https://github.com/jorgebucaran/hydro [1]: https://github.com/AlDanial/cloc

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

#83
Fan of starship here. wanted to drop a few comments based on what I seen so far

Love the performance. Written in Rust and compiled to binary, it's _much_ faster than either python-based powerline, the bash-shell-based ohmybash and zshell-based ohmyzsh and spaceship.

You can use it for zsh, bash, sh, fish. but you can also use it for both MS Windows CMD and Powershell. I don't believe any other prompt tools can do all at the same time. And a single config file can control all of them on your system.

The default config is just that - a default. Too much information? you can change it. dont like icons? you can remove them.

At almost 100 modules to choose from, it's customization options are nearly limitless

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

#84
post #62
post #49

Earlier quoted context omitted.

If you're used to, say, VS Code or the GitHub online editor where the lag between pressing a key on the keyboard and a corresponding character appearing on the screen can be on the order of tens of thousands of milliseconds, then 100 ms will seem like lightning.

There's a thousand milliseconds in a second. If your VSCode is taking +10 seconds to display a single character, it might be time to upgrade from your Commodore 64.

Or to switch from VSCode to SpeedScript

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

#85
I have been using ZSH + various add-ons for ages, originally oh-my-zsh, and lately Prezto. I also somewhat maintain a fork of Prezto with improvements for Mac, mostly for my own personal use (although apparently quite a few others are using it as its gotten several stars). Historically I used powerline9k, powerlevel, powerline10k, and finally pure for the longest time. I switched to starship the last time it got posted on HN that I saw, which was around 2 or 3 years ago, and I've stuck with it since. For one thing, it had a mode to configure it exactly like pure very simply out of the box, and the second reason was because it was significantly faster. By moving more of the logic into starship and out of ZSH, it greatly reduced the performance hit I took by adding additional information into my prompt.

I know not everyone likes blinged out shells, but if you're a ZSH user, it fits very well into the Prezto/oh-my-zsh model.

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

#86

I like maximalist prompts, and indeed Starship is what Shell Bling Ubuntu [1] installs on a new dev machine. But they're not everyone's cup of tea. If I wanted to recommend to someone the min-maxed, highest density thing they could add to their prompt, it would simply be the time your current prompt appeared + the amount of time the last command you ran took. These two pieces of information together make it very easy…

The exit code of the last command is useful for similar reasons.

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

#87
post #8

Tried it. Not a fan. I find it unnecessarily fancy.

Then customize it not to be. Are you criticizing it for having too many configuration options?

For a non-fancy prompt, setting PS1 is enough - no need to install anything.

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

#88

I live in the terminal, so I wrote my own prompt ages ago when I started learning Go[1][2], and before that I had a simple prompt in bash. I like to keep things very simple and fast, so the directory and the git branch is all I need. I wonder if people really use all that information or if they set it up thinking they need it, but then never do. [1]: https://git.sr.ht/~jamesponddotco/gosh [2]: I should probably updat…

The only thing I add is the time (hh:mm:ss), it's often-ish useful to roughly know how long a command has been running for (or how long it took after it completed)

The `cmd_duration` starship module can additionally tell you how long the previous command took: https://starship.rs/config/#command-duration

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

#90
post #75

Earlier quoted context omitted.

When you’re debugging, especially a complex system, especially during an outage or postmortem, understanding when your commands executed relative to when your log lines appeared is really helpful.

That's a poor and hacky substitute of using Linux audit features. It's perhaps the right robustness/complexity trade off for my personal machine, but for work they likely already have audit features turned on and you can access the timing from there.

I think you need to put a number on "likely", here. 80% of all workplaces, maybe? Even that seems a little high. There are a surprising number of devs who have never even heard of auditd. It's just not the kind of thing most people come across in their day to day work unless they go digging for it, or come from a security or DevOps background or something.
Post reply on HN