Improved PHP omni-completion. Based on the default phpcomplete.vim.
- 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)
butconst VARIABLE = 1
) - Better class detection:
- Recognize
/* @var $yourvar YourClass */
type mark comments - Recognize
$instance = new Class;
class instantiations - Recognize
$instance = Class::getInstance();
singleton instances - Recognize
$date = DateTime::createFromFormat(...)
built-in class return types - Recognize type hinting in function prototypes
- Recognize types in
@param
lines in function docblocks - Recognize
$object = SomeClass::staticCall(...)
return types from docblocks
- Recognize
- Displays docblock info in the preview for methods and properties
- Updated built-in class support with constants, methods and properties
- Updated list of PHP constants
- Updated list of built-in PHP functions
- Namespace support ( Requires patched ctags )
-
Install the pathogen.vim plugin, follow the instructions here
-
Clone the repository under your
~/.vim/bundle/
directory:cd ~/.vim/bundle git clone git://github.com/shawncplus/phpcomplete.vim.git
-
Install and configure the Vundle plugin manager, follow the instructions here
-
Add the following line to your
.vimrc
:Bundle 'shawncplus/phpcomplete.vim'
-
Source your
.vimrc
with:so %
or otherwise reload your vim -
Run the
:BundleInstall
commmand
In order to support some php features introduced in PHP 5.3 you will have to use
a ctags binary that can generate the appropriate tags files. At this moment there's no
offical build of ctags that would do the job, so you will have to build one for yourself.
Check out the wiki page about the patched ctags for more information.
let g:phpcomplete_relax_static_constraint = 1/0 [default 0]
Enables completion for non-static methods when completing for static context (::
).
This generates E_STRICT
level warning, but php calls these methods nontheless.
let g:phpcomplete_complete_for_unknown_classes = 1/0 [default 1]
Enables completion of variables and functions in "everything under the sun" fassion
when completing for an instance or static class context but the code can't tell the class
or locate the file that it lives in.
The completion list generated this way is only filtered by the completion base
and generally not much more accurate then simple keyword completion.
let g:phpcomplete_min_num_of_chars_for_namespace_completion = n [default 1] Requires patched ctags
This option controls the number of characters the user needs to type before
the tags will be searched for namespaces and classes in typed out namespaces in
"use ..." context. Setting this to 0 is not recommended because that means the code
have to scan every tag, and vim's taglist() function runs extremly slow with a
"match everything" pattern.
let g:phpcomplete_parse_docblock_comments = 1/0 [default 0]
When enabled the preview window's content will include information
extracted from docblock comments of the completions.
Enabling this option will add return types to the completion menu for functions too.
let g:phpcomplete_cache_taglists = 1/0 [default 0]
When enabled the taglist() lookups will be cached and subsequent searches
for the same pattern will not check the tagfiles any more, thus making the
lookups faster (no cache expiration implemented as of now).