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

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 feel free to get in touch on Mastodon or Twitter, or leave a comment.

Published on in Vim