This plugin uses the power of LeaderF to perform PHP namespace related tasks.
https://github.com/xbot/Leaderf-phpnamespace
Features
- Insert
usestatements for FQCNs. - Sort
usestatements alphabetically. - Expand class names to FQCNs.
- Insert namespace for the current file.
- All the above features support the fuzzy searching function and all the three modes (nameonly, fullpath and regex) provided by LeaderF.
Requirements
- LeaderF
- ctags is properly configured in Vim/Neovim.
Install
Use any of your favourite plugin manager to install it, for example:
vim-plug
| |
Setup
| |
Commands
| Command | Description |
|---|---|
| LeaderfPhpns | Choose an FQCN to import. |
| PHPNamespaceInsert | Insert namespace for the current file. |
Press F1 in the popup window to get more help.
Options
| Option | Default | Description |
|---|---|---|
| g:Lf_PHPNamespaceExpandToAbsolute | 1 | Expand the classname under cursor to absolute FQCN. |
| g:Lf_PHPNamespaceSortAfterImport | 1 | Sort the use statements block alphabetically after importing a class. |