Highlight Normal only for filetype in vim -
so, i'm pretty happy i've discovered how set highlighting when open particular file in vim. i'm doing javascript files, of them 'hi jsstringd' , 'hi jsfunction' etc. use trigger it:
if has("autocmd") augroup javascript au! au bufreadpost *.js call setupjavascript() augroup end ...
i want change color of 'normal' or foreground text, javascript files.
this works set color:
execute 'hi normal ctermfg=' normaltext
but how limit filetype? results in files having 'normal' highlighted color.
edit: clarify, open javascript file , works. open file (say .jade file) , 'normal' color remains 'normaltext' value.
use autocmd fires javascript file type
autocmd filetype javascript execute 'hi normal ctermfg=' normaltext
however think have problems if switch between multiple files in 1 session since highlighting global.
to work around add filetype autocmd fires on bufenter (or that) sets default normal highlighting.
something work (although change highlighting in splits when change focus)
autocmd bufenter * if (&filetype ==# 'javascript') | execute 'hi search ctermfg=' . normaltext | else | execute 'hi search ctermfg=' . defualttext | endif
Comments
Post a Comment