how to set syntax highlight permanency in vi ?

Asked by dp

 i tried the :syntax enable command get a syntax highlight in vi editor. but this has to be done each time a program is typed.any permanent way of enabling?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu vim Edit question
Assignee:
No assignee Edit question
Solved by:
Cristi Nistor
Solved:
Last query:
Last reply:
Revision history for this message
Cristi Nistor (cristi-nistor) said :
#1

Edit the .vimrc configuration file and add syntax on anywhere in the file. The command to edit is

vi ~/.vimrc (it's a hidden file)

Good luck.

Revision history for this message
dp (superdp87) said :
#2

can u elaborate more on the procedure....

Revision history for this message
Best Cristi Nistor (cristi-nistor) said :
#3

Based on what package do you have installed, vim-full or vim-nox you can enable syntax highlight. I presume that you have one of those packages, as long as you can use syntax highlight. You can enable it using :syntax enable or :syntax on commands for the session you are using vim ( read more here http://www.vim.org/htmldoc/syntax.html ). to make it permanently you have to edit the vimrc file located in /etc/vim/virmc and uncomment "syntax on" statement (remove the left and right double quotes) and the syntax highlight is enabled every time you use vim. This behavior will be inherited for every user working at that machine. The other method is to add in .vimrc hidden file the statement "syntax on" (without the double quotes) in your /home/user/ directory using the command above or

vi /home/user/.vimrc

I hope is more clear now.

Good luck.

Revision history for this message
dp (superdp87) said :
#4

thank you.