Vim, how to reload syntax highlighting

tomekfranek picture tomekfranek · Dec 29, 2011 · Viewed 22.4k times · Source

When I execute Rmodel, Rcontroller and others in Vim. I see only white text. But when I go to next buffer and then go back by :bn and :bl, colors are working.

This is my .vim folder https://github.com/regedarek/dotvim

Answer

Mike Lippert picture Mike Lippert · Jun 19, 2013

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>