load syntax as per file prefix

Posted by Richo on Server Fault See other posts from Server Fault or by Richo
Published on 2010-12-30T22:21:55Z Indexed on 2010/12/30 22:55 UTC
Read the original article Hit count: 204

Filed under:

Firstly, I hope that this is the right place. I couldn't decide between here and superuser.

My home directory lives in an svn repo. all my dotfiles are in version control so that I can track them across multiple machines, and they all source an unversioned .local (ie, .screenrc.local, .vimrc.local etc) which can override/make local changes to the environment in a machine specific way.

The problem is that vim understands how I want to edit many of these config files, but loses it's mind when I open a .local, and honestly, I'm not really sure what it does to work out how to syntax highlight etc a file like .screenrc

the pseudocode for what I'm after is:

if OpenedFile.ends_with(".local")
  behave_as_per OpenedFile[0:-6]
endif

I hope this makes sense and hopefully someone can shed light on whether or not this is possible.

© Server Fault or respective owner

Related posts about vim