3 ms·
My major step forward in bash prompt setup earlier this year was realising it didn't have to be a single line. I have one info line which tells me path, user,
by glenjamin 15y ago
My major step forward in bash prompt setup earlier this year was realising it didn't have to be a single line.
I have one info line which tells me path, user, host, git branch etc. And then the prompt sits nicely on the line below and is always at the same alignment.
http://i.imgur.com/0F6qt.png http://i.imgur.com/0F6qt.png
- jkmcf 15y agoI use the same except my 2nd line has history id and time: 136 11:33:48 $ export PS1='\[\e[32m\]\u@\h \[\033[33m\]\w\[\033[00m\] $(__git_ps1 "(%s)") ${rvm_ruby_string}\n\# \[\033[31m\] \[\033[00m\]\t \\$ '
- glenjamin 15y agoHere's the bash incantation for that: command_exists __git_ps1 && git="$c_vcs\$(__git_ps1)" PS1="\n$c_path\w$git $c_id\u@$prompt_host$c_reset" $c_* vars are just for colour, the command_exists switch lets me use the same dotfile on boxes which don't have git installed.