composerwith smart completion of subcommands and flags. It even completes package names from remote package repositories such as packagist.org. Composer.vim doesn’t care what your current working directory is, rather it activates when the current buffer belongs to a Composer project, and Composer.vim has no trouble dealing with multiple Composer projects simultaneously.
- Navigate to source files by invoking
<Plug>(composer-find)with the cursor on a class, interface, or trait name. This feature takes advantage of Composer’s autoloader to take you to the right file. The fully-qualified class name will be resolved automatically from the context. No tags file is needed.
- Insert a
usestatement for the class, interface, or trait under the cursor by invoking
<Plug>(composer-use). Composer.vim can also keep your
usestatements sorted alphabetically, although this feature is currently experimental.
- Optional Projectionist support: Invoke
:Ecomposerto edit your project’s
:Ato jump to
- Optional Dispatch support:
No mappings are provided by default. Here is a sample configuration for your vimrc:
autocmd User Composer nmap <buffer> <LocalLeader>f <Plug>(composer-find) | \ nmap <buffer> <LocalLeader>u <Plug>(composer-use)
:help composer for further details.
Installation and Requirements
Using vim-plug, for example:
Plug 'tpope/vim-dispatch' Plug 'tpope/vim-projectionist'
Note: either Projectionist.vim or Vim version 7.4.1304 or later is required for JSON support.
Credits and License
Thanks to Tim Pope for Bundler.vim on which Composer.vim is modeled.
Copyright © Noah Frederick. Distributed under the same terms as Vim itself.