Fix several issues in vimrc

Getting git branch for status line was causing issues were
characters were being displayed wrongly. To fix this, the current branch
is now stored in a global variable that is updated when a buffer is
read. In hind sight, it was probably very inefficient to be making
external calls every single time the statusline was updated anyway.

This commit also fixes issues where using arrow keys in insert mode
would cause capital letters to be inserted instead of moving the cursor.
This was caused by mapping escape to escape+write which has now been
changed to use an autocmd when leaving insert mode.

Also made a few other adjustments such as setting the syntax
highlighting correctly for *.md files and showing the name of file being
edited in the statusline rather than just the buffer number.

Also in this commit: moved source ~/.bashrc from beginning to end of
.bash_profile. Not sure which way is the *correct* way but this way we
always have our green smiley for success status when opening a term
instead of red unsmiley because X didn't start.
Merge branch 'master' into dev