Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim, how to reload syntax highlighting

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

like image 934
tomekfranek Avatar asked Dec 29 '11 22:12

tomekfranek


People also ask

How do I turn on syntax highlighting in Vim?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

How do I refresh a file in vi?

You can use the :edit command, without specifying a file name, to reload the current file. If you have made modifications to the file, you can use :edit! to force the reload of the current file (you will lose your modifications). The command :edit can be abbreviated by :e . The force-edit can thus be done by :e!

Where do I put syntax in Vim?

Install the syntax file. Save the file, then install it by copying the file to ~/. vim/syntax/cel. vim on Unix-based systems, or to $HOME/vimfiles/syntax/cel.


1 Answers

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> 
like image 116
Mike Lippert Avatar answered Nov 14 '22 11:11

Mike Lippert