Updating PHP Syntax Highlighting for vim on Ubuntu

This is just a quick post, mostly a "note to self" so I don’t forget how to do this. If you were curious, it was the result of indirect inspiration from these Become a Bash Ninja slides.

If you’re running Ubuntu 8.10 as your desktop OS, have vim installed, and use it for PHP development, you may not be aware that the PHP syntax file that comes bundled with vim is a bit outdated. There’s a fairly simple way to update it, though. In fact, it’s doable with two simple commands from Terminal.

cd /usr/share/vim71;
wget -O - http://www.vim.org/scripts/download_script.php?src_id=8651 | sudo tar -zxv

4 Comments

  1. Actually, it’s usually better to install that stuff in your local profile. You can do the equivalent with:

    cd ~/.vim/

    and then doing your wget line but omitting the “sudo” after the pipe. (Also, in shells like csh and zsh, you need to put quotes around the URL; otherwise some of the characters get interpreted as shell operators.)

    Thanks for the tip, though — this is indeed a slightly better version than I’d been using previously.

  2. As a reminder note, In my installation of Ubuntu Intrepid is /usr/share/vim/vim71.

  3. @Giorgio Thanks for sharing. Seems very odd that your path is different from mine, as I’m already running Ubuntu 8.10 (64 bit).

    @Matthew I see a .vimrc file in my home directory, but not a .vim subdirectory. That something you normally have to create manually? Thanks also for the URL tip — guess I’m just too used to bash. :)

  4. Jim Plush says:

    thanks for the tip, worked liked a charm.