If it were possible I would live my terminal all the time.
It’s not. As much as I want to like vim, we just don’t get on. I used to be an emacs devotee back in the heady days of youth, but even that seems strangely antiquated now.
So, I have to leave the terminal now and then.
But to make the my time there as pleasant as possible there are a few little things I like to add to my .bash_profile to ease my working day.
Make it look nicer
There really is no choice for colour schemes other than homebrew. If you’re not using it you’re either too busy working to care, or a loser. I can’t decide right now.
While it’s does take the theme a step away from it’s roots, I like to make sure the text is set to anti-aliased. Why? Because I’m not that hardcore.
Make your path more obvious
There’s always the obvious pwd to get your current location, but those are 3 characters I’d rather not keep repeating, especially as I have a famously scattered memory for things like this.
Dropping
PS1="\n\w "
into you’re .bash_profile throws out the current path in your prompt changes the colour scheme slightly too. That makes it just dandy. We’re getting there.
Love your branches
Do you use git? If you do, you obviously love your branches. But oh noes! you say, I keep forgetting my current branch and have to go through the rigmarole of git stash, git stash pop all the time.
Well – to stop myself repeatedly (and I do mean repeatedly) working on the wrong branch, adding this :
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
changes your prompt to append your current git branch (if you’re in a git repo) inline after the current path. With that on your side you’ll never need to worryingly do a git branch in panic again.
# Colours from http://wiki.archlinux.org/index.php/Color_Bash_Prompt
NO_COLOR='\e[0m'
CYAN='\e[0;36m'
ERED='\e[1;31m'
# Command prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\n\[$CYAN\]\w \[$ERED\]\$(parse_git_branch)\[$CYAN\]\n➔\[$NO_COLOR\] "
Here we are, at then end of all things
So, with all those tiny tweaks I end up with a terminal prompt that looks somewhat like this :
Is it perfect? No. But it’s getting closer, and if you’re that way inclined, get my current .bash_profile.
*I stole some of these settings from other developers. I have no shame about this. I’m looking at you @monooso.