Live data from Hacker News

Starship.rs: minimal, fast prompt for any shell

starship.rs

41–50 of 160 posts

Re: Starship.rs: minimal, fast prompt for any shell

#41
post #32

The "minimal" part is a little funny. Historical minimal shell prompts: $ # % >

I think a huge amount of these prompts are just fiddling with things because people think they are clever, not because they are actually useful. My prompt for years has been: : ▶ I add the hostname if it’s an SSH session and change ▶ to # if I’m root because those are both important contexts that should be omnipresent, but aside from that, I haven’t felt like I’m missing anything at all. The CWD is in the window / ta…

I do the same thing with SSH sessions (no hostname if local). Also:

* username if it's not "me"

* indicator if in `screen` or `tmux` session

* `cwd`

* in reverse-video or bold, on terminals that support that, to stand out

All these things have been useful many times.

Most often, which is shells on local laptop, the prompt is only a reverse-video cwd. The extras appear for less-usual situations.

I should add Git info.

Re: Starship.rs: minimal, fast prompt for any shell

#42
post #32

The "minimal" part is a little funny. Historical minimal shell prompts: $ # % >

here's a tip for people that I stole from PLAN9:

If your shell is ZSH and you have `setopt autocd` in your .zshrc (though I think this setting is on by default):

export PS1="%~; "

this will result in the prompt: `~; ` where the ~ will change to a path relative to home.

Why do this? Well; it means you can select and paste any line in your history: your prompt becomes part of setting the proper context and is part of the command. Just select the entire line. :D

Re: Starship.rs: minimal, fast prompt for any shell

#43

Earlier quoted context omitted.

I think a huge amount of these prompts are just fiddling with things because people think they are clever, not because they are actually useful. My prompt for years has been: : ▶ I add the hostname if it’s an SSH session and change ▶ to # if I’m root because those are both important contexts that should be omnipresent, but aside from that, I haven’t felt like I’m missing anything at all. The CWD is in the window / ta…

Git information is extremely useful to me. I notice colleagues who don't have that tend to struggle using git on the command line and use git status nearly every other command (much as I tend to do when I'm remoting into a shell with a plain prompt). Python venvs are useful too if you have a shell for running the program and other shells that just happen to be within that directory.

Largely of the same mind. I've found starship very useful and have been using it everywhere I can fit a few years now.

Re: Starship.rs: minimal, fast prompt for any shell

#44
post #28

Is there a Unicode symbol for source branch used there? Not really keen on using some specific fonts just for that. I usually use simple ^ but having something like there would be nicer.

There's a pretty broad list of amended nerd fonts. Some of the more complete code fonts have most of the symbols already.

Re: Starship.rs: minimal, fast prompt for any shell

#45
post #24

what kind of psychopath has a two line prompt?

I also can't understand the two-line prompt. I want my prompt to take as little space as possible.

I appreciate the extra context information. Displaying the user/system over ssh is pretty nice. I've also done similar in windows for network drives.

Re: Starship.rs: minimal, fast prompt for any shell

#46
post #42
post #32

The "minimal" part is a little funny. Historical minimal shell prompts: $ # % >

here's a tip for people that I stole from PLAN9: If your shell is ZSH and you have `setopt autocd` in your .zshrc (though I think this setting is on by default): export PS1="%~; " this will result in the prompt: `~; ` where the ~ will change to a path relative to home. Why do this? Well; it means you can select and paste any line in your history: your prompt becomes part of setting the proper context and is part of t…

zsh-histdb achieves something similar. Combined with zsh-autosuggestions it's quite nice.

https://github.com/larkery/zsh-histdb

Re: Starship.rs: minimal, fast prompt for any shell

#47
Since this is now a share your prompt thread, here's mine:

https://github.com/rollcat/etc/tree/master/cmd/prompter

It's quite portable (didn't test on Windows though); ~170 lines of Go; no dependencies outside of stdlib; calls no external commands; supports SSH, git, Docker, nix, and virtualenv; extremely simple to hack on.

Re: Starship.rs: minimal, fast prompt for any shell

#48

It’s too bad this requires a Nerd font to be installed according to the landing page. I just don’t think that belongs in a terminal emulator and it should be optional

Many code fonts have the bat majority of the symbols already. The new MS Terminal for Windows uses Cascadia, and IIRC only missing the node logo IIRC.

Other fonts work to. I use Fira Code myself.

Re: Starship.rs: minimal, fast prompt for any shell

#49

Earlier quoted context omitted.

I think a huge amount of these prompts are just fiddling with things because people think they are clever, not because they are actually useful. My prompt for years has been: : ▶ I add the hostname if it’s an SSH session and change ▶ to # if I’m root because those are both important contexts that should be omnipresent, but aside from that, I haven’t felt like I’m missing anything at all. The CWD is in the window / ta…

Git information is extremely useful to me. I notice colleagues who don't have that tend to struggle using git on the command line and use git status nearly every other command (much as I tend to do when I'm remoting into a shell with a plain prompt). Python venvs are useful too if you have a shell for running the program and other shells that just happen to be within that directory.

It's probably a bell curve and you're only seeing the left side.
Post reply on HN