My .bashrc and .emacs Configs
At the request of some of my buddies, I’m making a short blog post here to share my emacs configuration file as well as my bashrc file. I don’t think there is a whole lot going on in either of these, but there are some nice tricks I’ve picked up over the years. The links to download will get updated over time. To start off with, we’ll go over my bashrc since it is the simpler of the two.
Bash RC
Grab my .bashrc file and I’ll go over some of the special features. It starts off by dot sourcing in any other system wide bash configuration files (including the excellent bash_completion config). It then creates a PATH variable that most notably includes the current directory so you can just execute blah.py instead of ./blah.py. I then define my editor as emacs, increase my history file and require it to only store unique entries (instead of like 4000 cd ~/ commands for example). It then defines all the basic terminal colors to help make building and changing my prompt easier (stuff like production = PURPLE, development = RED, etc). After that I set my terminal title bar (thanks to Nick), enable grep color if possible, add some alias commands for ssh and common switches, and export my uber prompt. My prompt is really kind of nice due to it dropping input down a line and starting with a hash symbol. This results in very nice scriptable copy and paste commands like:
Where the blue line down is just a paste of the previous commands. The # and newline make the prompt a bash comment and what you enter a command.
After that cool prompt I just have a neat function I grabbed somewhere (and add to from time to time), that will extract pretty much any archive file I have without me having to remember the switches to pull out a gzipped tarball vs. a bz2. It is always just: extract file_name
Emacs
My emacs config is slightly more complex since it includes some handy libraries. To install it, you will need to copy the file emacs to your ~/.emacs and create a ~/.emacs.d folder. Copy the vendor folder into ~/.emacs.d/. That should be all you need (of course back up your existing config if you don’t want it overwritten. In general this nice config moves all your blah.blh~ files to ~/.emacs.d/backups (which makes for a nice central backup of previous versions), as well as your #filename# files to ~/.emacs.d/saves. It changes the default tab width to 4, gets rid of the welcome screen, gets rid of silly bells, and fixes tramp and other shells to handle the cool shell prompt defined above.
On top of that it adds a vbscript and powershell mode to the editor (for you Windows shell scripters), loads the lovely color-theme library and chooses a default theme, adds goto line (M-g), and adds a few handy commands like line wrapping and indenting entire buffers.
Hit me up with comments or send me an e-mail if you run into any snags or have suggestions for other neat bash and emacs configuration tricks.
