Vim or vi is a text editor. It can be used to edit all kinds of plain text. It is especially useful for editing programs or UNIX/Linux configuration files.
Turn on syntax highlighting:
Open file (for example test.sh):
$ vi test.sh
Now press ESC key to enter into command mode then type ” : syntax on OR syn on”
:syntax on
OR
:syn on
That’s it.. the color syntax highlighting will be enabled until you close that file (useful when you working on server where you can’t enable it permanently because of restriction and not having desired access of .vimrc file.)
Turn off syntax highlighting:
Press ESC key to enter into command mode then type “: syntax off OR syn off”
:syntax off
OR
: syn off
Enable color syntax highlighting permanently:
You may need to add "syntax on" (or "syn on") in your $HOME/.vimrc file
$ vi HOME/.vimrc
Add "syntax on" (or "syn on")
Press ESC to enter into command mode then
Save and close the file.
:wq <enter>
Please note: .vimrc is a system file so it will be hidden and you can see it by using command “ls”
Any comment would be appreciated thanks J