How to get vim to sync syntax highlighting when opening file -
i've got vim setup jump last known cursor position when opening file, position in middle of javascript or css on html page, , syntax highlighting doesn't catch that. can manually run
:syntax sync minlines=200 to fix highlighting, i'd vim run me whenever open file.
i tried in vimrc, doesn't fix syntax highlighting when open file.
" jump last known cursor porition autocmd bufreadpost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " sync syntax highlighting autocmd bufreadpost * syntax sync minlines=200 i close , reopen vim, should getting new .vimrc settings.
not sure i'm missing here. thanks.
ok, got using bufwinenter event instead of bufreadpost
" jump last known cursor porition autocmd bufreadpost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " sync syntax highlighting autocmd bufwinenter * syntax sync minlines=200
Comments
Post a Comment