Doxygen highlighting is set up by default on most Vim installations, but for some reason it’s disabled. There are two options for enabling it.

First, it can be enabled globally. This means adding the parameters to the global Vim configuration. Note that you may need to be root for this to work (ie: sudo echo “let g:load…), and that the path may need to change for different linux distributions (this one works for ubuntu):

echo "let g:load_doxygen_syntax=1" >> /etc/vim/vimrc

Alternatively, you can configure doxygen highlighting for your user only:

echo "let g:load_doxygen_syntax=1" >> ~/.vimrc

Either way, you will need to restart any vim applications before the changes will take effect.

  1. Andrew says:

    Thanks!

  2. Andrew says:

    Thanks!

  3. Narate says:

    Thanks a lot!! 🙂

  4. lili says:

    I’m use ubuntu + vim7.3 + pathogen
    let g:dox…. open vim error, may be not load c.vim syntax file

  5. > you may need to be root for this to work (ie: sudo echo “let g:load…)

    This won’t work: sudo lets echo run as root, but >> is still interpreted by the shell, which is run as the user, and therefore doesn’t have write permissions to system files.

    One alternative is to first use sudo -s or sudo -i, to get a root shell or interactive session, respectively, then type ‘echo …’ command with the redirection. As the newly spawned shell will run as the superuser, there will be no problem.

    Over time, I found that using tee(1) [0] was useful to keep such one-liners on one line: echo doesn’t need any privilege, but the process writing to the file does, which is what I use tee for:
    echo “whatever” | sudo tee -a /PATH/TO/SYSTEM/FILE

    [0] http://linux.die.net/man/1/tee