This project contains the most feature complete and up to date PHP Integration for Vim. It began as a fork of the largely outdated VIP (formerly PDV), but has morphed into it's own project.
It is intended to include the best PHP specific plugins, configurations and resources for editing PHP. Special care has been taken to include the best, keep them up to date and make sure everything plays well together.
It doesn't attempt to include the best programming plugins, so you can use the plugins you prefer.
The bottom of this readme includes a list of many great plugins that work well with PIV. If you are looking for an excellent VIM configuration, please checkout The Ultimate VIM Configuration.
Updated for PHP 5.3
The list of PHP constants, functions, and classes was updated to be current with PHP 5.3. Many new classes were added in the 5.2 and 5.3 branches and the distributed version only covers up to 5.1.4.
This plugin can fold PHP functions and/or classes, properties with their PhpDoc, without manually adding marker style folds ({{{ and }}}) https://www.vim.org/scripts/script.php?script_id=1623
Can be turned off by setting let g:DisableAutoPHPFolding = 1 in your .vimrc file.
Generate phpDocumentor conforming documentation blocks for your PHP code.
To use place cursor on line with class, function or variable definition and type ,pd (in n mode)
PHP completion script for use with omniComplete. Using Shawn Biddle's excellent phpcomplete.vim script
Completion from current file, included files, tags and php builtin:
* classes (after new),
* functions
* variables
* constants
* language keywords
Either use or install SuperTab to use. By default will show a preview of the function call.
Completion is done via context, for example after -> and :: options limited to funcs and vars.
Example class which has a TAGS file generated for it somewhere class SomeClass { private function _private_method() {} // never shows up in completion list public static function staticMethod() {} // only shows up when using completion on SomeClass:: public function completeMe() {} // only shows up when using completion on $instance_of_someclass-> }
$instance = new SomeClass;
...
$instance-><C-X><C-O> to display the omnicompletion menu (see :help ins-completion)
$instance->completeMe(); // will autoselect completeMe since it's the only public non-static method
SomeClass::<C-X><C-O> to display omnicompletion menu
SomeClass::staticMethod(); // once again will autoselect staticMethod since it's the only public static method
$instance = SomeClass::getInstance();
$instance-><C-X><C-O> complete just like non-static
- Correct restriction of static or standard methods based on context ( show only static methods with :: and only standard with ->)
- Real support for self:: and $this-> with the aforementioned context restriction
- Constant variable completion (not just define(VARIABLE, 1) but const VARIABLE = 1)
Custom php indenting file for VIM
Simply hit K (shift+k) on any function to see full documentation file for that function even offline.
It isn't my intention to provide php specific functionality when a good general purpose solution exists.
The following plugins are recommended and can be found in my Ultimate VIM Configuration.