Skip to content

arnaud-lb/vim-php-namespace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Goal

vim-php-namespace is a vim script for inserting "use" statements automatically.

Features

vim-php-namespace automatically inserts the use ... statement corresponding to the class under the cursor

Installation:

If you don't use tpope/pathogen:

Copy plugin/phpns.vim to ~/.vim/plugin/

Add mappings:

Add this in ~/.vim/ftplugin/php.vim: (create the file if necessary)

imap <buffer> <Leader>u <C-O>:call PhpInsertUse()<CR>
map <buffer> <Leader>u :call PhpInsertUse()<CR>

The script makes use of tag files. If you don't already use a tag file you may create one with the following command; after having installed ctags-exuberant:

ctags-exuberant -R --PHP-kinds=+cf

or

ctags -R --PHP-kinds=+cf

(The AutoTags plugin can update the tag file every time a file is modified.)

Usage:

When the cursor is on a classname, hit <Leadder>u to add the corresponding use statement. (<Leader> is usually the \ key.)