dotfiles, vim & tmux

Back dated: 2014-05-08

Once upon a (most inopportune) time I overwrote my precious .zshrc that I so carefully and meticulously had crafted to suit my development needs. This is a post about how I recovered from my mistake, and now am on top of the situation. I started by restoring my previous configuration as follows...

I use zsh as my primary shell on my machine largely because it was easy to get up and running with a great git prompt and it has useful autocompletion and aliases/functions in the form of the collective effort called oh my zsh.

But first, my idiocy:

I wanted to append something to my config as I often need to, and the easiest way to do so on unix is something like this:

$ echo "export SETTING=value" >> ~/.zshrc
// ... but I made a fatal typo:
$ echo "export SETTING=value" > ~/.zshrc

Notice I am no longer concatenating the output of echo, but rather overwriting my entire shell configuration!

The recovery

The first thing I did was to rename the default (backup) .oh-my-zsh
config file ~/.oh-my-zsh/templates/zshrc.zsh-template like so:

$ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Now when I opened a new session I at least had something decent.

Luckily for me I still had a terminal session running using my previous configuration that I had just wiped. I used the following commands to retrive all my environment variables, aliases and functions that I used.

$ env
$ alias
$ functions

And with these few lines I was pretty much good to go!

The age of git

I thought it appropriate to upload my shell config to github so it was backed up, and so I could share it with anyone that asked me about my setup. I decided to just upload my config for all my favourite tools at the moment:

.zshrc Slightly modified version of .oh-my-zsh with some handy aliases for my current dev stack.

.vimrc I'm most proud of this, especially thanks to Kevin for his help on this one.

.tmux.conf I'm new to tmux but this is the most exciting for me at the moment. I use tmuxinator to define 'dev' and 'blog' projects I can quickly tap into pre-configured tmux sessions.

.gitconfig Random git config, basically for me.


tmux / vim / shell screenshot

The left pane is a ruby spec file open in vim (notice the powerline status bar), the right panel is a rails web server running, and the bar at the very bottom is my tmux status that has my machine name server : window : pane then the center is the list of windows, and to the right is my current battery charge and the date.

It seems I've lost this image - checkout the screenshot on my github page linked below.

Sharing is caring

Naturally, here is a link to my config files on github.

http://github.com/sighmin/dotfiles

Simon van Dyk

Read more posts by this author.

Johannesburg, South Africa