How to color syntax in VIM

The regular use of the console (or terminal) is very comfortable for certain tasks, and we almost always look for ways and alternatives to make its use more intuitive. Usually what we do is color the prompt or our favorite text editor to better distinguish the elements.

In the case of Vim, the syntax can be colored in several ways. The classic example is editing the file / etc / vim / vimrc, in which we look for the line:

"syntax on

and we uncomment it. When we access Vim we come across something like this:

But we can change the color scheme and also, we have a resource that allows us to choose between several schemes: Vivify. In Vivify we can choose the scheme we want to download. Once we have selected the one of our preference, we must copy the downloaded file to the folder:


For example, I got one called tango2. To use it, we enter VIM and put:

:syntax on
:colorscheme tango2

And it automatically takes this color, which as you can see, is more comfortable to work with:

If you don't work with Vim and you use Nano, you can see these two articles that may be useful:


Support for nano of CSS, PHP, C / C ++, HTML, Python, etc.

Highlights Python code in nano (editor in terminal)

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

17 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Zernad said

    Interesting, I'll try it. Thank you

  2.   xykyz said

    Say that in Arch the file to modify is / etc / vimrc and that in any distribution you can create the file ~ / .vimrc and save the settings there so that they only affect the user in question.

    Personally I like to also modify the width of the tab with 'set tb = 2'. Manias that one has 😛

    1.    xykyz said

      Sorry, it was 'set ts = 2'

  3.   Hugo said

    By the way, if you allow me a bit of off-topic: I don't know if you've heard the joke that a good way to get a random string of characters is to open vim and ask a newbie to try closing it, hehehe.

    1.    Aetsu said

      how big the joke xD

      By the way, I use colorscheme asmanian2

      1.    Linux user (@taregon) said


        ¬.¬ I have even struggled to insert text in «vi»

    2.    elav <° Linux said

      Hahahahahahaha great hahahaha

      1.    merlinoelodebianite said


    3.    Oberost said

      Heroic, hahahahaha

    4.    KZKG ^ Gaara said

      LOL!! yes hahahaha that joke I had already read ... HAHAHAHA

    5.    proper said

      HAHAHAHAHAHHAHAA very good !!!

      for sure, I use or used

      set background = dark

  4.   Diavolo said

    Interesting, I'm going to try changing the colors 😀

  5.   Daniel said

    Something that I usually do after installing vim and enabling SyntaxOn is to add "set number" to it anywhere in the file, with this the line numbers are enabled 🙂

    1.    Ivan Barra said

      If it works, thank you, even if the post is a little old.

  6.   hackloper775 said

    Very good, I use gedit with plugins for ruby ​​and nano for python or PyPE flat, I'm going to test VIM with colors to see how it works

    Thank you

  7.   Daniel Noriega said

    I just did something very easy in Arch, when you see the content of / etc / vimrc (in Arch this is the address of the file) it mentions that you look at the example located in /usr/share/vim/vim74/vimrc_example.vim

    There are a lot of options configured by default including those to activate the syntax. But in order not to complicate my life too much, what I did was execute the following command from my home folder

    cp /usr/share/vim/vim74/vimrc_example.vim ./.vimrc

    and voila, now it looked like a programming editor

  8.   xerm8 said

    How about friends, I'm still immersing myself in this great ocean of command possibilities of this great Vim editor, I'm amazed, it's great, I just learned all the basics and the truth is that I liked it a lot. Well regarding this post, I would like you to help me with my next question… It is necessary to put »: colorscheme [color]«, every time I open Vim, is there any way to make it automatic ???