Giter Site home page Giter Site logo

cntoby / phpcd.vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taoso/phpcd.vim

0.0 1.0 0.0 1.93 MB

Vim PHP 补全服务(PHP Completion Daemon for Vim)

Home Page: https://github.com/php-vim/phpcd.vim

Vim Script 59.76% PHP 39.20% Shell 1.04%

phpcd.vim's Introduction

asciicast

简介

PHPCD,全称 PHP Completion Daemon,译为 PHP 补全服务。PHPCD 实现了 Vim 的 omni 补全接口,提供 PHP 相关的智能补全和定义跳转服务。

PHPCD 的 VimL 部分基于phpcomplete.vim,感谢原项目贡献者的努力。原项目的 3k+ 行代码已经被裁剪为 1.5k 行,可维护性大为增强。

因为 PHPCD 利用 PHP 的反射机制进行补全和跳转,所以 PHPCD 几乎不需要事先生成索引文件,启动速度、补全速度和跳转速度都非常快,代码也非常简洁。

PHPCD 目前只能配合NeoVim工作,这是一个艰难的抉择。

特色

  • 快、轻、强
  • 静态调用Class::method()显示静态成员和方法;动态调用$class->method()显示非静态成员变量和方法
  • 真正识别selfstatic$this上下文环境
  • 支持通过多种方式推断变量类型:
    • 变量类型注解 /* @var $yourvar YourClass *//* @var YourClass $yourvar */
    • 使用 new 初始化类实例 $instance = new Class;
    • 函数(全局函数、成员函数和匿名函数)参数的类型提示 function (Foo $foo) { // .. }
    • 使用函数块注释中 @return 制定函数返回值的类型
  • 补全成员方法和成员属性的时候自动显示块注释
  • 支持内建类的方法、属性、常量的补全
  • 增强型定义跳转ctrl+]

安装指南

环境要求

  1. PHP 5.3+
  2. PCNTL 扩展
  3. Msgpack 0.5.7+(NeoVim) 扩展或者JSON(Vim 7.4+) 扩展
  4. Composer 支持

安装 PHPCD

推荐使用Vim-Plug管理 Vim 插件。

安装 Vim-Plug 后,添加:

Plug 'php-vim/phpcd.vim', { 'for': 'php' , 'do': 'composer update' }

然后执行:PlugInstall进行安装。

使用方法

首先运行 composer install 更新依赖并生成自动加载文件,然后打开 NeoVim。

补全按Ctrl+xCtrl+o,跳转按ctrl+]

phpcd.vim's People

Contributors

gitter-badger avatar imaben avatar przepompownia avatar shadowhand avatar still-dreaming-1 avatar taoso avatar xerkus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.