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?

ankush981
  • 201
  • 1
  • 8
  • 1
    have you tried downloading another color scheme ? you can find some on : http://vimcolors.com/ – nobe4 Jul 08 '15 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 Jul 08 '15 at 10:59
  • Hmm, the color schemes look interesting, but I'm having trouble installing. I selected https://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 Jul 08 '15 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 Jul 08 '15 at 11:09
  • @Nobe4 Hey, I guess that particular color scheme was broken. I tried another one and it worked! Thanks for pointing me in the right direction. :-) – ankush981 Jul 08 '15 at 11:14
  • And yes, I did reset php.vim – ankush981 Jul 08 '15 at 11:16
  • 1
    glad I could help, I recommend watching http://vimcasts.org/episodes/creating-colorschemes-for-vim/ if you want to create your own colorscheme :) – nobe4 Jul 08 '15 at 13:49
  • @Nobe4 Superb! I can't express how happy this has made me! :) :D – ankush981 Jul 09 '15 at 03:34

1 Answers1

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.

ankush981
  • 201
  • 1
  • 8