Vim, how to reload syntax highlighting
Tried all the above - none worked for me.
The only thing that does work is:
:filetype detect
so I remapped a quick shortcut
:noremap <Leader>,ftd :filetype detect
Try:
:e
If you have no unsaved changes to the file.
Or:
:syn off | syn on
Use :syntax sync fromstart
I got that tip from http://vim.wikia.com/wiki/Fix_syntax_highlighting
That article also suggests creating a mapping for that command e.g. to map F12:
noremap <F12> <Esc>:syntax sync fromstart<CR>
inoremap <F12> <C-o>:syntax sync fromstart<CR>