Vimrc: how to reuse code and definitions for differnt file types?

Posted by sixtyfootersdude on Stack Overflow See other posts from Stack Overflow or by sixtyfootersdude
Published on 2010-05-11T19:43:41Z Indexed on 2010/05/11 19:54 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

I have defined my own file types using vim. For example I have:

.classNotes
.reportJotNotes
.homework

These file types are defined in .vim files:

~/.vim/syntax/homework.vim
~/.vim/syntax/reportJotNotes.vim
~/.vim/syntax/homework.vim

Many of these things have several of the same code in them. Ie they all have this for titles:

syn region JakeTitle start=+=== + end=+===+ oneline
highlight JakeTitle ctermbg=black ctermfg=Yellow

syn region JakeMasterTitle start=+==== + end=+====+ oneline
highlight JakeMasterTitle cterm=bold term=bold ctermbg=black ctermfg=LightBlue

Instead of having this in all three .vim files I would rather have it in one file and then in each file could source it. How can I do this?

© Stack Overflow or respective owner

Related posts about vim

Related posts about vimrc