Vim (for Vi Improved) is a screen-oriented text editor originally created for the Unix operating system. This guide install some helpful plugins for PHP development.

This howto is tested on:

  • Debian 10.0 Buster

Requirements

This howto requires:

Installation

Detect if sudo is available (“command” is used if not):

cmdProxy='command'
command type -f 'sudo' &>'/dev/null' && cmdProxy='sudo'

Install the required software:

${cmdProxy} apt install 'unzip'

A graphical user interface for Vim exists: gvim, using the GTK toolkit. Install it with:

${cmdProxy} apt install 'vim-gtk3'

A modern alternative to Vim exists: NeoVim a.k.a. nvim. Install it with

${cmdProxy} apt install 'neovim-qt'

Configuration

PDV : phpDocumentor for Vim

PDV is a tool generating automatically the code documentation of a PHP script. Install PDV:

command mkdir -p "${HOME}/.vim"
command wget "http://www.vim.org/scripts/download_script.php?src_id=4666" \
    --output-document="${HOME}/.vim/php-doc.vim"
command echo '
" PDV : phpDocumentor for Vim
" http://www.vim.org/scripts/script.php?script_id=1355
source ~/.vim/php-doc.vim
inoremap <C-P> <ESC>:call PhpDocSingle()<CR>i
nnoremap <C-P> :call PhpDocSingle()<CR>
vnoremap <C-P> :call PhpDocRange()<CR>' \
   >> "${HOME}/.vimrc"

This tool is used by pressing <Ctrl>+ <P> when the cursor is on a class, function, constant, etc. declaration.

Vimball

Vimball is a helper easing development of Vim extensions. Install Vimball:

command mkdir -p "${HOME}/.vim"
command wget "http://www.vim.org/scripts/download_script.php?src_id=8743" \
    --output-document=- \
  | command tar --directory "${HOME}/.vim/" -oxvzf -

Align

Requires : Vimball

This plugin ease code alignment. Install Align:

command wget "http://www.vim.org/scripts/download_script.php?src_id=10110" \
    --output-document="/tmp/Align.vba.gz"
command vim -c "so %" -c "q" "/tmp/Align.vba.gz"
command rm "/tmp/Align.vba.gz"

SQL Utilities

Requires : Align

SQL Utilities ease the creation of SQL queries. It provides a SQL query formatting feature. Install SQL Utilities:

command wget "http://www.vim.org/scripts/download_script.php?src_id=9825" \
    --output-document="/tmp/sqlutil_300.zip"
command unzip -qq -d "${HOME}/.vim" "/tmp/sqlutil_300.zip"
command rm "/tmp/sqlutil_300.zip"

This plugin features are available in “Plugin -> SQLUtil” menu.

Bibliography

Thanks

Categories: Unix Shell

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.