Skip to content

Up-to-date PHP syntax file (5.3–5.6 support)

Notifications You must be signed in to change notification settings

KhronosWebservices/php.vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

php.vim

This project is a fork of php.vim--Garvin which in turn is an update of the php.vim script which in turn is an updated version of the php.vim syntax file distributed with Vim. Whew!

👉 Accepting pull requests for PHP 5.6 new features. 👈

Installation

If you don't have a preferred installation method, pathogen.vim is quick and simple. With pathogen.vim installed, run the following commands:

cd ~/.vim/bundle
git clone https://github.com/StanAngeloff/php.vim.git

Configuration

  • g:php_syntax_extensions_enabled, g:php_syntax_extensions_disabled
    b:php_syntax_extensions_enabled, b:php_syntax_extensions_disabled

    A list of extension names (lowercase) for which built-in functions, constants, classes and interfaces is enabled / disabled.

Overriding Highlighting

Syntax highlighting can be configured to distinguish groups by overriding the defaults. For example, all code in PHP comments is highlighted as phpComment, however there are pieces you can tweak, e.g., how @tags appear. There are many groups you can choose from. Here is how you can override PHP @tags and $parameters in comments to appear in a different group:

" Put at the very end of your .vimrc file.

function! PhpSyntaxOverride()
  hi! def link phpDocTags  phpDefine
  hi! def link phpDocParam phpType
endfunction

augroup phpSyntaxOverride
  autocmd!
  autocmd FileType php call PhpSyntaxOverride()
augroup END
![Overriding Highlighting](http://i.imgur.com/eAlB1eb.png)

Updating

The project comes with a Dockerfile which can be used to rebuild the syntax file.

docker build -t stanangeloff/php.vim .
docker run --rm -i -v "$PWD":/var/php -t stanangeloff/php.vim > /tmp/php.vim && cat /tmp/php.vim | sed 's/\x0D$//' > syntax/php.vim
docker rmi stanangeloff/php.vim

About

Up-to-date PHP syntax file (5.3–5.6 support)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 95.1%
  • PHP 4.9%