Code Monkey home page Code Monkey logo

vim-phpfmt's Introduction

Vim-phpfmt

This project follows a Code of Conduct.

Inspired by vim-php-cs-fixer. This plugin integrates phpfmt.

This plugin will execute the fmt.phar command on the directory or file (depends on which command you call). See options to know how to customize that.

If you see any improvement or question, please, contribute or create an issue.

Keeping up-to-date:

This plugin updates fmt.phar during VIM opening. If this fails, please open an issue stating what happens and possible logs.

Options available:

let g:phpfmt_on_save = get(g:, 'phpfmt_on_save', 1) " format on save (autocmd)
let g:phpfmt_php_path = "php"               " Path to PHP
"let g:phpfmt_prepasses_list = "AutoPreincrement,JointToImplode"
"let g:phpfmt_passes_list = "ReturnNull"
let g:phpfmt_enable_default_mapping = 1     " Enable the mapping by default (<leader>pcd)
"let g:phpfmt_indent_with_space = 4         " use spaces instead of tabs for indentation
"let g:phpfmt_enable_auto_align = 1         " Enable auto align of = and =>
"let g:phpfmt_visibility_order = 1          " Fixes visibiliy order for method in classes - PSR-2 4.2
"let g:smart_linebreak_after_curly = 1      " Convert multistatement blocks into multiline blocks

Default mapping is <leader>pcf (formats a file) and <leader>pcd (formats the whole directory of the file).

If you want to change it, update plugin/phpfmt.vim file, editing these lines:

nnoremap <silent><leader>pcd :call PhpFmtFixDirectory()<CR>
nnoremap <silent><leader>pcf :call PhpFmtFixFile()<CR>

Installation

Via Vundle, add:

Bundle 'dericofilho/vim-phpfmt'

Open VIM and execute: :PluginInstall

Via Pathogen, do:

cd ~/.vim/bundle
git clone [email protected]:dericofilho/vim-phpfmt.git

Via vim-plug, add:

Plug 'phpfmt/vim-phpfmt'

Open VIM and execute: :PlugInstall

vim-phpfmt's People

Contributors

tboqi avatar yeaha 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.