Giter Club home page Giter Club logo

padawan.vim's Introduction

Padawan.vim

Padawan.vim is a vim plugin for padawan.php server , a smart PHP code completion server for Composer projects.

This plugin includes:

  • Omnifunc
  • Commands for index generation and index saving
  • Commands for starting, stopping and restarting the server

Demo video

Currently Padawan.vim offers basic completion for methods and classes based on doc comments and method signatures.

Click the image below to watch a short video on what Padawan.vim can already do. ScreenShot

Requirements

Padawan.vim requires:

  1. PHP 5.4+
  2. Composer
  3. Vim with +python

Installation

Install Padawan.vim using any of the popular plugin managers like Pathogen, Vundle, Neobundle or Plug.

Pathogen

To install Padawan.vim with Pathogen do the following steps:

$ cd TO YOUR PLUGINS FOLDER
$ git clone https://github.com/mkusher/padawan.vim.git
$ cd padawan.vim
$ git submodule update --init --recursive
$ sh install.sh

Plug

Add this to your vimrc

Plug 'mkusher/padawan.vim', { 'do': './install.sh' }

How to use

  • In your php composer project folder, run the following vim command to generate an index:
:PadawanGenerateIndex
  • Start Padawan.php server with:
:PadawanStartServer
  • Enjoy smart completion

Index generation can take a while, but needs to be performed only once per project.

Autocomplete engines

You should set semantic triggers like

let g:ycm_semantic_triggers = {}
let g:ycm_semantic_triggers.php =
\ ['->', '::', '(', 'use ', 'namespace ', '\']

You should set omni input patterns like

let g:neocomplete#force_omni_input_patterns = {}
let g:neocomplete#force_omni_input_patterns.php =
\ '\h\w*\|[^- \t]->\w*'

Plugins(Extensions)

You can extend Padawan.php by installing different plugins. See Plugins List for more info.

Installing

To install a plugin, run :PadawanAddPlugin PLUGIN_NAME, for example:

:PadawanAddPlugin mkusher/padawan-symfony

Removing

To remove a plugin, run :PadawanRemovePlugin PLUGIN_NAME, for example:

:PadawanRemovePlugin mkusher/padawan-symfony

Configuring

You may want to change Composer to the one already installed on your system. You can do so by with the following line:

let g:padawan#composer_command = 'php /usr/bin/composer.phar'

Another configurable option is http request timeout. The following example sets it to 100 ms:

let g:padawan#timeout = 0.1

Vim functions

For quick access to the functions below, map them to keys of your choice.

Index generation

Use padawan#GenerateIndex() function:

:call padawan#GenerateIndex()

Index saving

Use padawan#SaveIndex() function:

:call padawan#SaveIndex()

Starting server

Use padawan#StartServer() function:

:call padawan#StartServer()

Stopping server

Use padawan#StopServer() function:

:call padawan#StopServer()

Restarting server

Use padawan#RestartServer() function:

:call padawan#RestartServer()

padawan.vim's People

Contributors

mkusher avatar azangru avatar

Watchers

James Cloos avatar  avatar  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.