Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you're using git, I suggest fixing up your prompts so it doesn't display the sign for Mercury when in a git repo.

So much junk in a prompt... I clicked on the link to Steve Losh's page and had a heck of a time figuring out what commands he had actually typed.

The bash defaults are pretty reasonable: show your working directory, maybe your username, and a $ to end the prompt. If you're root, you get a # instead. It stays out of the way; if you want to get fancy, colorize it so lines you entered stand out. These days, I even turn off ls's colorizing half the time; then again, I always thought wibbley-wobbley 3d windows with glowing buttons were a little silly compared to, say, FVWM or i3.



> So much junk in a prompt... I clicked on the link to Steve Losh's page and had a heck of a time figuring out what commands he had actually typed

The point of configuring your prompt is it has to be easy for you to read. Whether someone else finds it readable or not is a non issue. Though not as verbose as Steve Losh's, I use a similar prompt which looks like this:

    rahul@mean-machine: ~/musings (git::master)
    ± $
There is nothing in that prompt which I would remove. I login on different hosts with different usernames(rahul@mean-machine); working directory is obvious; I use git, svn, hg and switch branches a lot(git::master).

Of course why do I need rahul@mean-machine - I can run 'who' and 'hostname', why do I need working directory - it's not like 'pwd' hasn't been invented yet; why would I need the branch name - 'git branch' is where it is at. But "if there is this painful long way you can do it, why would you do it the easy way" doesn't make sense to me.

> These days, I even turn off ls's colorizing half the time;

I am curious. What purpose that solves? Colorizing it helps me differentiate directories, files, executables, broken links.

> then again, I always thought wibbley-wobbley 3d windows with glowing buttons were a little silly compared to, say, FVWM or i3.

I don't think 'ls --color=auto' is comparable to woobly window.


A whole extra line above the working prompt? That just seems unnecessary.

If you need that info at any particular moment, make a command. I used to have one called wi (short for Where am I?) that threw out similar info. But displayed constantly? Yuck!


> A whole extra line above the working prompt?

Because it's frequently useful, and thus the tradeoff of a bit of space for simplicity, speed and familiarity is worth it.

> If you need that info at any particular moment, make a command.

Right, so your prompt is composed of nothing but the hardcoded character `>`? (you obviously don't need the $/# toggle as you can use `whoami`, and you don't need the previous command's status as that's what `$?` is for)


Setting your prompt to ";" can be useful, because then if you want to select a command with the mouse and paste it into another window, it's still valid even if you select the whole line--you don't have to worry about stopping at the prompt character, just triple-click the line (in X).


> Right, so your prompt is composed of nothing but the hardcoded character `>`

Hey that's what mine is! Actually it is simply the ')' character. I went from full on prompt-porn to nothing. For the most part this was just to see how much of the prompt I really needed on a daily basis (how often do I really type git branch because I don't know what branch I'm on, how often do I type pwd... stuff like that). Turns out I rarely use those commands, but to each their own.


It's an interesting approach! I want to try it in combination with some custom 1-or 2-letter command that would display all this 'prompt-porn' in a single line on demand.

Maybe a 1 or 2-letter indicator on what host I am (e.g. nothing for local, P for production, C for cluster head...), got confused too often.

And, of course, fuzzy completions of zsh.


My prompt is usually the system default, because I work across multiple systems, some of which don't even have bash (let alone zsh), and changing it seems unnecessary. 'wi' is just there to remind me where I am once in a while.

My general philosophy is to deal with whatever is the default and not become reliant on customisations because other systems I'll be required to use won't have any of them set up.


> My prompt is usually the system default, because I work across multiple systems,

Unless you get new systems everyday, multiple systems just mean copying ssh keys followed by scp of dotfiles.

> some of which don't even have bash (let alone zsh),

If it has bash, .bashrc gets executed. If it has neither, I use the system default. Just because sometimes there won't be a shell I use or configure(1%) doesn't mean I am going to put up with whatever the system throws at me(99%).

> 'wi' is just there to remind me where I am once in a while.

Any my "once in a while" is frequent. Multiple machines, multiple projects, multiple branches.

> My general philosophy is to deal with whatever is the default and not become reliant on customisations because other systems I'll be required to use won't have any of them set up.

If I have customized my vim to hell, it generally means I am familiar enough with vim to understand how vim works. Same goes for bash, screen, zsh, what have you. It isn't like when once in an eternity, I am forced to use a machine where I have to type "git branch" instead of "gitb", I am going to forget it.


Everything is unnecessary. Some things are nice. Some of the nicest things are those which reduce cognitive load. Anything that makes it easier for my brain to "lex" the wall of text in front of my face is very nice indeed.

The fact that my prompt shows additional information is a secondary thing. (It's sometimes nice to scroll back through output and be able to see what directory I was in.) The _important_ thing is that the color and extra space make it exceedingly easy to visually chunk commands and output.


How did wi differ from the built-in pwd? I've never found myself wishing for more than that.


Not by much, it was only four things - pwd, hostname, username and (when I was working in clearcase a lot) clearcase view name.

Just something I could run if I switched back to a shell and kinda forgot what or where it was.


A friend of mine has an extremely simple prompt. It just shows as $ or # (for root) and has a single field before that - the exit status of the previous command.


Still way too complex, simplicity means subscribing to the ed school of prompts: neither `$` nor `#`, just `?` when the previous command returned a non-zero status.


I understand using that because it was what you had, but why would you choose to strip your prompt of useful information? (I'm not trying to degrade the idea here, just wondering what use case it provides. It could have a very good one.)

I've never had a difficult time telling the difference between where my prompt ends and where the result begins. I think too much grows absurd quickly, but a little bit of information is nice, I think.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: