Extend / change vim highlighting for all file types at the same time?

How to extend / change vim-highlighting for all file types at the same time?

I have some relatively simple templates that I would like to highlight in a different way, which can happen in any type of file. So instead of adding something like below to any conceivable file type that I could use (~ / .vim / syntax / python.vim, ... / css.vim, ... / html.vim, ...), is there some I can define it once for all file types?

syn match   SpecialComment  "@[@\-+].*" containedin=Comment
syn match   Comment     "\* .*$"hs=s+1  containedin=SpecialComment

update:

As I said, I saved the changes to ~/.vim/after/filetype.vim, as a result of which it works in Cream , but does not contain Gvim or Vim, the actual code that I use here , a sample python file to check here , and the desired result:

what the pastebin filetypes.vim looks like in Cream

+3
source share
1 answer

You can try putting these two lines in ~/.vim/after/filetype.vim. This should be obtained after any of the top-level syntax files. This may not be the “right” place, but it should work.

filetype.vim is apparently derived from syntax files, so it is overwritten by default syntax file. Therefore, I would recommend you create a new file with the name:

~/.vim/after/common_syntax.vim

, . ~/.vim/after/filetype.vim:

if !exists("after_autocmds_loaded")
    let after_autocmds_loaded = 1
    au BufNewFile,BufRead * source ~/.vim/after/common_syntax.vim
endif

, , .

P.S. : " " plain ol "comment " pythoncomment " ..?", , - pythonComment, , . , , containedin=ALL. , , containedin=ALLBUT,conflictgroup, conflictgroup - , .

+3

Source: https://habr.com/ru/post/1777396/


All Articles