6

I'm unhappy with the default syntax highlighting in vim and would like to change it. I tried to follow the accepted answer on this page, but I think my vim version (7.4) is different.

Inside /usr/share/vim/vim74/syntax I have tons of files, so I decided to edit php.vim. But I find that the format in the file isn't like the one in the link I mentioned. Here's my php.vim file.

Can someone help me figure out how to customize vi syntax highlighting?

8
  • 1
    have you tried downloading another color scheme ? you can find some on : vimcolors.com
    – nobe4
    Commented Jul 8, 2015 at 10:39
  • 1
    It may come as a surprise to you, but syntax files don't specify colours. What you want to change is your colours scheme, not the syntax files. Messing with files in /usr/share/vim/vim74 is likely to break vim. Just pick a colour scheme and install that.
    – lcd047
    Commented Jul 8, 2015 at 10:59
  • Hmm, the color schemes look interesting, but I'm having trouble installing. I selected github.com/scheakur/vim-scheakur and then created scheakur.vim inside ~/.vim/colors. After firing vim, I did set background=light and colorscheme scheakur when the whole (PHP) text became black! What could be wrong?
    – ankush981
    Commented Jul 8, 2015 at 11:07
  • can you confirm that you want to change the colorscheme @dotslash ? Because with what you did we got confused ... Did you reset the previous php.vim ?
    – nobe4
    Commented Jul 8, 2015 at 11:09
  • 1
    glad I could help, I recommend watching vimcasts.org/episodes/creating-colorschemes-for-vim if you want to create your own colorscheme :)
    – nobe4
    Commented Jul 8, 2015 at 13:49

1 Answer 1

4

(I'm answering my own question so that it can be closed. All credit to @Nobe4 and @lcd047)

The /usr/share/vim/vim74/syntax directory doesn't have colors, surprisingly. What is needed to change syntax highlighting in vim is a colorscheme. These can be placed in ~/.vim/colors/ and activated in vi with set syntax on and colorscheme cool_color_scheme.vim. It's also possible to make one's own color schemes; check out http://bytefluent.com/vivify/ for a visual colorscheme maker/editor for vim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.