1- Padawan.vim for php
2- ====================
1+ Padawan.php for composer projects
2+ =================================
33
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.
4+ Smart php intelligent code completion plugin for composer projects.
5+ It tries to be a [ Jedi] ( https://github.com/davidhalter/jedi-vim ) ,
6+ but currently it's only a padawan.
77
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 ) .
8+ This plugin was inspired by
9+ [ phpcomplete-extended by M2mdas] ( https://github.com/m2mdas/phpcomplete-extended )
10+ and started as a fork with completely rewritten index generation part.
11+ But as of now it is completely new project with different design and principles
1212
13- Currently it's under development and does not support some of the original
13+ Currently it's under development and does not support some of the original
1414plugin features.
1515
16- Plugin
17- ======
16+ Project
17+ =======
1818
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
22- [ vimproc.vim] ( https://github.com/Shougo/vimproc.vim ) plugin. Besides
23- autocomplete this plugin have several code inspection features:
19+ Padawan.php is an http server that parses your project and gives you
20+ completions.
21+ Padawan.php reads autoload classmap of a composer project, parses
22+ doc-comments and functions declarations of each class and creates index
23+ from them. After that it autoupdated index and give you completion
24+ as you send requests to http.
2425
2526* See documentation of current word, be it class name, method or property. It is
2627 context aware.
2728* Go to definition of a symbol. Also context aware.
2829* Automatically add use statement of current completed word. Also added plugin
2930 command of this action.
3031
31- Demo videos (click on the image to goto youtube) by M2mdas
32- ----------------------------------------------------------
33- ## Autocomplete demo video:
34-
35- [ ![ ScreenShot] ( http://img.youtube.com/vi/yZYFKslqkC8/maxresdefault.jpg )] ( http://www.youtube.com/watch?v=yZYFKslqkC8 )
36-
37-
38- Installation
39- -------------
40-
41- The plugin depends on following plugins:
42-
43- * php 5.4+
44- * [ vimproc.vim] ( https://github.com/Shougo/vimproc.vim ) : Asynchronous library for vim. Required for auto-update index. C
45- compiler is needed to build the plugiin. For windows install cygwin or
46- msys to get the compiler.
47-
48- Plugin managers are recommended for installing these plugins. Installation instructions for
49- various plugin managers are given bellow.
50-
51- ## Pathogen
52-
53- You should manually install vimproc.vim!
54- Issue following commands.
55-
56- ``` sh
57- git clone https://github.com/mkusher/padawan.vim ~ /.vim/bundle/padawan.vim
58- ```
59-
60- ## NeoBundle (preferred)
61-
62- You should manually install vimproc.vim!
63- Put these lines in ` .vimrc ` and issue ` source % ` command
64-
65- ``` vim
66- NeoBundle 'mkusher/padawan.vim', { 'build': {'unix': 'php /path/to/composer.phar install'} }
67- "your other plugins
68- NeoBundleCheck
69- ```
70-
71- You should have composer.phar installed.
72-
73- ## Vundle
74-
75- You should manually install vimproc.vim!
76- Put following lines in ` .vimrc ` and issue ` :BundleInstall ` command.
77- ``` vim
78- Bundle 'mkusher/padawan.vim'
79- "your other plugins
80- "....
81- ```
82-
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.
86-
87- Walk through of the plugin
88- -------------------------
89-
90- To enable omni complete add following line to ` .vimrc ` ,
91-
92- autocmd FileType php setlocal omnifunc=phpcomplete_extended#CompletePHP
93-
94- Then issuing ` <C-X><C-O> ` in insert mode will open the completion pop-up menu.
95-
96- This plugin is tested in Windows and Linux. It should work in OSX also.
97-
98- For now this plugin supports [ Composer] ( http://getcomposer.org/ ) PHP projects.
99- Upon detecting a composer project the plugin scans classmap generated by `php
100- composer.phar dumpautoload --optimize` command. By default composer command is
101- set to ` php composer.phar ` . The command can be changed by setting
102- ` g:phpcomplete_index_composer_command ` global variable.
103-
104- The plugin is dependent on ` @var ` , ` @param ` , ` @return ` doc-comments and class
105- declarations to give proper context aware
106- autocomplete. So documenting your class will help tremendously. It does not
107- analyse full class. Just parses the variable declaration to get the relevant
108- tokens. Does not provide autocomplete suggestion if there is error in code.
109-
110- Indexing may take some time depending on project size. To decrease index creation time I
111- would recommend disabling xdebug extension in cli. To do that go to the location
112- where ` php.ini ` resides and copy the ` php.ini ` file as ` php-cli.ini ` and comment
113- out the xdebug line. To verify issue ` php -m | grep xdebug ` in commandline.
114-
115- For configuration reference see helpdoc.
116-
117-
118- Auto complete plugin supports
119- -----------------------------
120-
121- ## [ neocomplete] ( https://github.com/Shougo/neocomplete.vim )
122-
123- Neocomplete support is built-in and my preferred autocomplete plugin. It needs
124- vim with lua bindings. To know more about installation refer to the plugin
125- repository.
126-
127- ## [ supertab] ( https://github.com/ervandew/supertab )
128-
129- Minimal configuration for supertab support,
130-
131- autocmd FileType php setlocal omnifunc=phpcomplete_extended#CompletePHP
132- let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
133-
134- ## [ YouCompleteMe] ( https://github.com/Valloric/YouCompleteMe )
135-
136- If ` omnifunc ` set the omni completer of ` YouCompleteMe ` should get the completion
137- candidates. You should check semantic trigers for php.
13832
13933Why not original plugin
14034-----------------------
@@ -143,9 +37,13 @@ The M2mdas's plugin is pretty good, but have some core bugs due to
14337self-written parser:
14438
14539* It does not support files with 2 or more classes in it
146- * It fails on parsing RabbitMQ classes
40+ * It fails on parsing RabbitMQ classes and many others
41+ * So it has some design fails which needs global plugin redesign
42+ * It will be really hard to add assignments parsing and
43+ other to original plugin, not this one
44+ * It is vim-only and is written on VimScript
14745
148- So, I decided to rewrite index generation part .
46+ So, I decided to write my own plugin .
14947
15048Roadmap
15149-------
@@ -169,7 +67,5 @@ Acknowledgement
16967
17068This plugin would not be possible without the works of
17169[ M2mdas] ( https://github.com/m2mdas ) ,
172- [ Shougo] ( https://github.com/Shougo ) ,
173- [ shawncplus] ( https://github.com/shawncplus/ ) ,
174- [ tpope] ( https://github.com/tpope/ ) , [ vim-jp] ( https://github.com/vim-jp ) ,
175- [ thinca] ( https://github.com/thinca ) and many others.
70+ [ Dave Halter] ( https://github.com/davidhalter )
71+ and many others.
0 commit comments