3 ms·
I like to put useful information in the prompt, but yours looks too cluttered for my liking. I particularly dislike the fact that most of the information of yo
by enriquto 8y ago
I like to put useful information in the prompt, but yours looks too cluttered for my liking. I particularly dislike the fact that most of the information of your prompt is nearly constant, thus very redundant. Putting the CWD inside the prompt is useless. You can just run pwd yourself if you are lost, but most of the time you already know where you are. Similarly for the username and the hostname. If you only deal with two or three servers, you can color code your prompt symbol to those, and obtain a much shorter and cuter prompt.
Useful information that is still not in your prompt:
- status of the last run command: $?
- number of jobs in the background, if any
I have this, with some colors thrown in:
PS1='$(if [ \j != "0" ] ; then echo "[\j]"; fi)$?\$ '
- xelxebar 8y agoThat's all quite easy to change in the rprompt() function. I tried hard to factor everything out, so the prompt content specification itself is clear and obvious. Basically, for the reasons you mention, I dislike having that info set in PS1, but I find it considerably less distracting when right-justified. Having it visible, though, makes it easy to ascertain the execution context of commands in the terminal history buffer. The status of last run command I have on my PS1. If it exits 0, then it's just a simple $ otherwise, it's: errno$ I do like your idea of showing current background jobs, but I find myself relying more on tmux windows than background jobs, so I suspect that number would be mostly constant for myself anyway.
- enriquto 8y ago> I do like your idea of showing current background jobs, but I find myself relying more on tmux windows than background jobs, so I suspect that number would be mostly constant for myself anyway. Sure! the idea is that background jobs are very rare, and their existence should be clearly indicated in the prompt (in bright red). Usually, there are zero jobs and the prompt is silent about that.