Host specific Vim config

I manage my Vim config in Git and store the files in a dotvim repository on GitHub. It allows me to share the config easily between multiple computers.

I prefer a slightly smaller font on my laptop to my desktop computer, so wanted to reduce the default font size on my laptop. I added this snippet to the end of my .gvimrc file:

let hostfile = $HOME . '/.vim/gvimrc-' . substitute(hostname(), "\\..*", "", "")
if filereadable(hostfile)
  exe 'source ' . hostfile
endif

Credit where it's due, I quite blatantly stole this from Jeroen's repo, but felt it was well worth a mention.

I love feedback and questions — please get in touch on Twitter or leave a comment.

Published on in Vim