Enable the Syntax highlighting in Vim.

5 réponses [Dernière contribution]
Mark
Hors ligne
A rejoint: 04/14/2012

Hello,

I need your help to enable the syntax highlighting in Vim.

I want to develop some website with HTML, CSS, PHP, SQL, JavaScript, JQuery... But I don't know how to enable the syntax highlighting.

:syntax enable don't work and :source $VIMRUNTIME/syntax/syntax.vim don't work too.

The terminal return :
E319: Sorry, the command is not available in this version
E484: Can't open file /usr/share/vim/vim73/syntax/syntax.vim

My version on Vim is the 7.3.429.

Can you help me please ? Thanks a lot.

eddie
Hors ligne
A rejoint: 05/18/2013

It works for me. i have added "syntax on" in ~/.vimrc (without quotes).

Did you apt-get install vim?
If yes, try apt-get install vim-gnome

Mark
Hors ligne
A rejoint: 04/14/2012

Thanks for your answer.

I'm sorry but where is the file : ~/.vimrc ? And how can add syntax on in this file ?

quiliro@congresolibre.org
Hors ligne
A rejoint: 10/28/2010

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

El 23/05/13 15:34, name at domain escribió:
> Thanks for your answer.
>
> I'm sorry but where is the file : ~/.vimrc ? And how can add syntax
on in this file ?

~/ is your home directory. For example mine is /home/quiliro
Inside that directory is .vimrc
The period before the name shows it is a hidden file.

- --
Saludos libres,

Quiliro Ordóñez
Presidente (en conjunto con el resto de socios)
Asociación de Software Libre del Ecuador - ASLE
Av de la Prensa N58-219 y Cristóbal Vaca de Castro
Quito, Ecuador
(02)-600 8579
IRC: http://webchat.freenode.net?channels=asle&uio=OT10cnVlJjEwPXRydWU3a

Todo correo que reciba será tratado como información pública, de libre
copia y modificación, sin importar cualquier nota de confidencialidad.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJRnoy8AAoJELMnJLlh/t+6oIgP+wW2DeEaa520X6c6aFevKC35
Dlqfq3eXN5vYyppmhN8wyyAu2epPXeRurPXBCJX1sQKOybyod6ML12d+KCcO6Vy6
OVJAQpXZEFJMxPlgAj5Byw9N/Bbcypq2BITR3FFJQF+r4rvATc84gbZmabswLJ01
0DOxZ5AaHXkG69b5mFY/RyIrgvRdYM+tU5/1IdYeXF+A00wnTe+hGoiVxwKAFAdr
oVkVpsvW9D3w9u6ztUjN1u3mvLBB3S12/Zcbd4wJ82tDQFNAP7z5T4CnigTe5cGO
Di4uZkDHCflxLACMyW62L8NCQCt6AxQCBZkp6phpuhe4sZfkAow9vnSKexmHXl8A
OatgAGi1wLtPNqU10LnPDASrn4iRjZMx3syTArlOicIelXJLpSFbW38VixSUfLLK
950xoWM4Lfkmz0o331b+j6OfRmXqeFspqDGc2+8HBEnB9g/bttI0qUh3uV1lLkF0
cNJ2GWyM1IayKj2WnrNrwLu/CHjbVt1JCf6ekW63CkGYCjSRvENzy0ZKi0HT+aZE
FkC4h3QKLwSY1bc2tAQmi7em6eGJIULyJzXppm4nDVLvCvbDYzzuynF/2qyQvWjV
Wjd0b2GerxYtBnW/G9MmhEwg+qGyTqZi7/iPCz8fhbnXL0WIZ/71zEuwZhj7jATt
540KyBbH6QLX0DWLN97a
=5c5v
-----END PGP SIGNATURE-----

lembas
Hors ligne
A rejoint: 05/13/2010

And how can add syntax on in this file ?

vi ~/.vimrc

eddie
Hors ligne
A rejoint: 05/18/2013

did you get syntax highlighting working?

it is not necessary to create .vimrc file in your home dir & add the command to it.

When you tried the command directly from inside vim, it should have worked.
:syntax enable should not give error

Have you installed vim explicitly?
By default there is only a basic minimal vim installed which doesnt have syntax highlighting.

You should try this
sudo apt-get install vim