PIV


Ⅰ. 插件描述

PHP Integration environment for Vim

Ⅱ. 基本信息

创建日期:  2010-04-20
使用用户:  320
Github星:  253
插件作者:  Steve Francia

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'spf13/piv'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'spf13/piv'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'spf13/piv'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/spf13/piv

Ⅳ. 文档说明

# PHP Integration for VIM

Description

This project contains the most feature complete and up to date PHP Integration for Vim.
It began as a fork of the largely outdated VIP (formerly PDV), but has morphed into it's own project.

It is intended to include the best PHP specific plugins, configurations and resources for editing PHP.
Special care has been taken to include the best, keep them up to date and make sure everything plays well together.

It doesn't attempt to include the best programming plugins, so you can use the plugins you prefer.

The bottom of this readme includes a list of many great plugins that work well with PIV.
If you are looking for an excellent VIM configuration, please checkout The Ultimate VIM Configuration.

Features

Updated Syntax

Updated for PHP 5.3

The list of PHP constants, functions, and classes was updated to be current with PHP 5.3.
Many new classes were added in the 5.2 and 5.3 branches and the distributed version only covers up
to 5.1.4.

Better Fold Support

This plugin can fold PHP functions and/or classes, properties with their PhpDoc,
without manually adding marker style folds ({{{ and }}})
http://www.vim.org/scripts/script.php?script_id=1623

Can be turned off by setting

let g:DisableAutoPHPFolding = 1

in your .vimrc file.

PHP Doc Gen

Generate phpDocumentor conforming documentation blocks for your PHP code.

To use place cursor on line with class, function or variable definition and type ,pd (in n mode)

Better Completion

PHP completion script for use with omniComplete.
Using Shawn Biddle's excellent phpcomplete.vim script

Completion from current file, included files, tags and php builtin:

* classes (after new), 
* functions  
* variables
* constants 
* language keywords 

Either use <C-X><C-O> or install SuperTab to use.
By default will show a preview of the function call.

Completion is done via context, for example after -> and :: options limited to funcs and vars.

Examples

Example class which has a TAGS file generated for it somewhere

class SomeClass { 
  private function _private_method() {} // never shows up in completion list 
  public static function staticMethod() {} // only shows up when using completion on SomeClass::<C-X><C-O> 
  public function completeMe() {} // only shows up when using completion on $instance_of_someclass-><C-X><C-O> 
} 

Non-static completion

$instance = new SomeClass; 
... 
$instance-><C-X><C-O> to display the omnicompletion menu (see :help ins-completion) 
$instance->completeMe(); // will autoselect completeMe since it's the only public non-static method 

Static completion

SomeClass::<C-X><C-O> to display omnicompletion menu 
SomeClass::staticMethod(); // once again will autoselect staticMethod since it's the only public static method 

Singleton completion

$instance = SomeClass::getInstance(); 
$instance-><C-X><C-O> complete just like non-static 

Other features

  • Correct restriction of static or standard methods based on context ( show only static methods with :: and only standard with ->)
  • Real support for self:: and $this-> with the aforementioned context restriction
  • Constant variable completion (not just define(VARIABLE, 1) but const VARIABLE = 1)

Better indenting w/automatic formatting

Custom php indenting file for VIM

Full (and current [5.3]) PHP Manual

Simply hit K (shift+k) on any function to see full documentation file for that function even offline.

Recommendations

It isn't my intention to provide php specific functionality when a good general purpose solution exists.

The following plugins are recommended and can be found in my Ultimate VIM Configuration.

添加新评论