1- phpcomplete-composer(WIP)
1+ Padawan.vim for php
22====================
33
4- This plugin is a fork of [ phpcomplete-extended by M2mdas] ( https://github.com/m2mdas/phpcomplete-extended ) with completely rebuilt index generation part. New index generator based on [ nikic/PHP-Parser] ( https://github.com/nikic/PHP-Parser ) .
4+ Smart php intelligent code completion plugin. It tries to be
5+ a [ Jedi] ( https://github.com/davidhalter/jedi-vim ) , but currently
6+ it's only a padawan.
7+
8+ This plugin is a fork of
9+ [ phpcomplete-extended by M2mdas] ( https://github.com/m2mdas/phpcomplete-extended )
10+ with completely rewritten index generation part.
11+ New index generator based on [ nikic/PHP-Parser] ( https://github.com/nikic/PHP-Parser ) .
12+
13+ Currently it's under development and does not support some of the original
14+ plugin features.
515
616Plugin
717======
818
9- phpcomplete-extended is a fast, extensible, context aware autocomplete plugin
10- for PHP composer projects. Initially it reads autoload classmap of a composer
11- project, parses doc-comments of each class and creates index from them. After
12- that it auto updates index as you type thanks to
19+ Padawan.vim reads autoload classmap of a composer
20+ project, parses doc-comments and functions declarations of each class and creates index
21+ from them. After that it auto updates index as you type thanks to
1322[ vimproc.vim] ( https://github.com/Shougo/vimproc.vim ) plugin. Besides
14- autocomplete this plugin have several code inspection features,
23+ autocomplete this plugin have several code inspection features:
1524
16- * Includes full core PHP documentation
1725* See documentation of current word, be it class name, method or property. It is
1826 context aware.
1927* Go to definition of a symbol. Also context aware.
2028* Automatically add use statement of current completed word. Also added plugin
2129 command of this action.
22- * If [ unite.vim] ( https://github.com/Shougo/unite.vim/ ) plugin installed following sources are available,
23- * ` phpcomplete/files ` : Lists PHP files of the project.
24- * ` phpcomplete/vendors ` : Lists vendor directories
25- * ` phpcomplete/extends ` : Lists classes that extends the class guessed from
26- the current cursor word.
27- * ` phpcomplete/implements ` : Lists classes that implements the class guessed
28- from the current cursor word.
29-
30- Demo videos (click on the image to goto youtube)
31- -----------------------------------------------
30+
31+ Demo videos (click on the image to goto youtube) by M2mdas
32+ ----------------------------------------------------------
3233## Autocomplete demo video:
3334
3435[ ![ ScreenShot] ( http://img.youtube.com/vi/yZYFKslqkC8/maxresdefault.jpg )] ( http://www.youtube.com/watch?v=yZYFKslqkC8 )
3536
36- ## Unite sources demo video:
37-
38- [ ![ ScreenShot] ( http://i1.ytimg.com/vi/Wd5G7QA3OFw/maxresdefault.jpg )] ( http://www.youtube.com/watch?v=Wd5G7QA3OFw )
3937
4038Installation
4139-------------
4240
43- The plugin depends on following plugins,
41+ The plugin depends on following plugins:
4442
43+ * php 5.4+
4544* [ vimproc.vim] ( https://github.com/Shougo/vimproc.vim ) : Asynchronous library for vim. Required for auto-update index. C
4645 compiler is needed to build the plugiin. For windows install cygwin or
4746 msys to get the compiler.
48- * [ unite.vim] ( https://github.com/Shougo/unite.vim/ ) : Optional, but enables some good features.
4947
5048Plugin managers are recommended for installing these plugins. Installation instructions for
5149various plugin managers are given bellow.
5250
5351## Pathogen
54-
52+
53+ You should manually install vimproc.vim!
5554Issue following commands.
5655
5756``` sh
58- git clone https://github.com/Shougo/vimproc.vim.git ~ /.vim/bundle/vimproc.vim
59- cd ~ /.vim/bundle/vimproc.vim
60- make
61- cd ..
62- git clone https://github.com/Shougo/unite.vim.git ~ /.vim/bundle/unit.vim
63- git clone https://github.com/m2mdas/phpcomplete-extended.git ~ /.vim/bundle/phpcomplete-extended
57+ git clone https://github.com/mkusher/padawan.vim ~ /.vim/bundle/padawan.vim
6458```
6559
6660## NeoBundle (preferred)
61+
62+ You should manually install vimproc.vim!
6763Put these lines in ` .vimrc ` and issue ` source % ` command
6864
6965``` vim
70- NeoBundle 'Shougo/vimproc', {
71- \ 'build' : {
72- \ 'windows' : 'make -f make_mingw32.mak',
73- \ 'cygwin' : 'make -f make_cygwin.mak',
74- \ 'mac' : 'make -f make_mac.mak',
75- \ 'unix' : 'make -f make_unix.mak',
76- \ },
77- \ }
78- NeoBundle 'Shougo/unite.vim'
79- NeoBundle 'm2mdas/phpcomplete-extended'
66+ NeoBundle 'mkusher/padawan.vim', { 'build': {'unix': 'php /path/to/composer.phar install'} }
8067"your other plugins
8168NeoBundleCheck
8269```
8370
84- If C compiler found for respective environment, ` neobundle ` will automatically
85- compile the library.
71+ You should have composer.phar installed.
8672
8773## Vundle
8874
75+ You should manually install vimproc.vim!
8976Put following lines in ` .vimrc ` and issue ` :BundleInstall ` command.
9077``` vim
91- Bundle 'Shougo/vimproc'
92- Bundle 'Shougo/unite.vim'
93- Bundle 'm2mdas/phpcomplete-extended'
78+ Bundle 'mkusher/padawan.vim'
9479"your other plugins
9580"....
9681```
9782
98- After installation goto ` vimproc ` folder and issue ` make ` command from command
99- line. C compiler must be installed.
83+ After installation goto ` padawan.vim ` folder and run
84+ ` php /path/to/composer.phar install ` command from command
85+ line. You should have composer installed.
10086
10187Walk through of the plugin
10288-------------------------
@@ -115,7 +101,8 @@ composer.phar dumpautoload --optimize` command. By default composer command is
115101set to ` php composer.phar ` . The command can be changed by setting
116102` g:phpcomplete_index_composer_command ` global variable.
117103
118- The plugin is dependent on ` @var ` , ` @param ` , ` @return ` doc-comments to give proper context aware
104+ The plugin is dependent on ` @var ` , ` @param ` , ` @return ` doc-comments and class
105+ declarations to give proper context aware
119106autocomplete. So documenting your class will help tremendously. It does not
120107analyse full class. Just parses the variable declaration to get the relevant
121108tokens. Does not provide autocomplete suggestion if there is error in code.
@@ -147,20 +134,31 @@ Minimal configuration for supertab support,
147134## [ YouCompleteMe] ( https://github.com/Valloric/YouCompleteMe )
148135
149136If ` omnifunc ` set the omni completer of ` YouCompleteMe ` should get the completion
150- candidates. I haven't tested it though.
137+ candidates. You should check semantic trigers for php.
138+
139+ Why not original plugin
140+ -----------------------
151141
152- Extensions
153- ---------
142+ The M2mdas's plugin is pretty good, but have some core bugs due to
143+ self-written parser:
154144
155- Phpcomplete Extended pluign exposes api hooks so that it can be possible to
156- provide framework specific autocomplete suggestion. For example facades in
157- laravel, DIC services in Symfony2 etc. The plugin api divided in two part, ` PHP `
158- and ` vim ` . PHP part is responsible for creating index related to the framework,
159- and vim part is responsible for providing autocomplete menu entries based on the
160- index. For reference see
161- [ phpcomplete-extended-symfony] ( https://github.com/m2mdas/phpcomplete-extended-symfony )
162- and
163- [ phpcomplete-extended-laravlel] ( https://github.com/m2mdas/phpcomplete-extended-laravel ) plugins.
145+ * It does not support files with 2 or more classes in it
146+ * It fails on parsing RabbitMQ classes
147+
148+ So, I decided to rewrite index generation part.
149+
150+ Roadmap
151+ -------
152+
153+ As of now this plugin sucks, but I'm working hard on it and these features are
154+ now in progress:
155+
156+ * Fix bugs with symbol type detection
157+ * Fix plugin user interface
158+ * Add doc-comment parsing
159+ * Add class inheritance indexing
160+ * Add plugins support
161+ * Add symfony2 plugin
164162
165163License
166164-------
@@ -175,4 +173,3 @@ This plugin would not be possible without the works of
175173[ shawncplus] ( https://github.com/shawncplus/ ) ,
176174[ tpope] ( https://github.com/tpope/ ) , [ vim-jp] ( https://github.com/vim-jp ) ,
177175[ thinca] ( https://github.com/thinca ) and many others.
178-
0 commit comments