to extend the C / CPP syntax (and which can be applied to any language, just check existing names like Constant
):
in ~/.vimrc
if has("autocmd") augroup filetypedetect au BufNewFile,BufRead *.myext setf mysyntax augroup END endif
and in ~/.vim/syntax/mysyntax.vim
runtime! syntax/cpp.vim syn keyword myConstant foo bar foobar quack hi def link myConstant Constant
To create new keywords from scratch:
syn match myKeyWord "foobar" contained hi kwRed term=standout ctermfg=12 guifg=Red hi def link myKeyWord kwRed
and you can call it with filetypedetect
or directly in .vimrc
source share