How to interactively set syntax highlighting in VI editor

Toshi picture Toshi · Oct 18, 2013 · Viewed 30.2k times · Source

Using vi, I want to display files in distinguished colors in unix. If I save a file as .sql or .java it will highlight the keywords. I want to make changes to which words are highlighted, and in what color.

How do I control syntax highlighting and color schemes with various vi file extensions?

Answer

Karol Król picture Karol Król · Jun 28, 2016

Type following command after a colon:

:set ft=sql.