Dotfiles and a .vimrc.local

Hi there!

I started using thoughtbot’s dotfiles a couple of weeks ago.
So far so good.

Now I wanted to add some custom configuration to my .vimrc without changing the dotfiles’ one.
I followed the .local convention but I realised it’s not meant to work that way with .vimrc.

So I erased the symlink to the dotfilesd vimrc, andcreated my own ~/.vimrc as follows:

source ~/dotfiles/vimrc
if filereadable(expand("~/.vimrc.local"))
  source ~/.vimrc.local
endif

In this way I can use the latest unchanged version of thoughtbot’s dotfiles and add my own config on top of it.

So, my question… is there a better way to do this?

Thanks!

Edit: improved my original .vimrc

Hi @fmquaglia, not sure what you mean with “but I realised it’s not meant to work that way with .vimrc”, but you certainly can configure / override without needing to modify the thoughtbot .vimrc.

You’ll want to leave the thoughtbot .vimrc symlink in place, and then add your configurations in a .vimrc.local. You can see the configuration hook at the end of the thoughtbot vimrc.

You seemed to have arrived at a very similar solution, so I’m not sure if I’m missing something, but the above should work for you.

1 Like

Hey @christoomey , thanks a lot, man!
Probably I was doing something wrong because it wasn’t picking up my .local file.
Obviously I missed that line in dotfiles/vimrc

I appreciate your help.
Thank you!