Vim how to reload syntax highlighting

When I run Rmodel, Rcontroller and others in Vim. I see only white text. But when I go to the next buffer and then return to :bn and :bl , the colors work.

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

+58
vim syntax-highlighting
Dec 29 '11 at 10:48
source share
6 answers

Use :syntax sync fromstart

I got this advice from http://vim.wikia.com/wiki/Fix_syntax_highlighting

This article also suggests creating a mapping for this command, for example. to display F12:

 noremap <F12> <Esc>:syntax sync fromstart<CR> inoremap <F12> <Co>:syntax sync fromstart<CR> 
+61
Jun 19 '13 at 10:48 on
source share

Try:

 :e 

If you do not have unsaved changes to the file.

Or:

 :syn off | syn on 
+28
Dec 29 '11 at 23:34
source share

Sometimes the syntax is fine, but all that breaks is the folds. In this case, zx helps a lot.

From the VIM documentation:

gh

Refresh folds: cancel open and closed folds manually: re-apply 'foldlevel', then do “zv”: view the cursor line. Also makes recount folds. This is useful when using 'foldexpr', and the buffer is changed in such a way that causes wrinkles to not be updated properly.

+8
Apr 11 '15 at 14:45
source share

Another variant:

 doautocmd Syntax 
+3
Sep 29 '14 at 7:12
source share

I tried all of the above - no one worked for me.

The only thing that works:: :filetype detect so I redid the quick shortcut :noremap <Leader> :filetype detect

+2
Jul 24 '17 at 13:41
source share

Try:

 :Rrefresh! 

This command updates certain cached settings and also reloads rails.vim .
This will help me update the syntax highlighting in Rails.

-one
Sep 23 '13 at 14:01
source share



All Articles