Skip to content

Instantly share code, notes, and snippets.

@MaskyS
Forked from komlenic/vim_phpcs_drupal_syntastic.txt
Last active December 23, 2017 08:37
Show Gist options
  • Save MaskyS/2006fb9bed3238c13ab43ee9592f6bd0 to your computer and use it in GitHub Desktop.
Save MaskyS/2006fb9bed3238c13ab43ee9592f6bd0 to your computer and use it in GitHub Desktop.
Installing drupal code standards in vim + syntastic
# Install vim syntastic (and php) first.
# Download the Drupal coder module. You could do this via other methods but git is nice.
# You can place this wherever, but take note of where you placed it. Something like
# /usr/local/src might be good.
git clone --branch 8.x-2.x http://git.drupal.org/project/coder.git
# Install php code sniffer (phpcs). Using pear.
pear install PHP_CodeSniffer
# Test if phpcs was installed correctly.
phpcs --version
# Tell phpcs where the Drupal coding standards live.
ln -sv /path/to/coder/coder_sniffer/Drupal $(pear config-get php_dir)/PHP/CodeSniffer/Standards
# Add this line to .vimrc.
let g:syntastic_php_phpcs_args = " --standard=Drupal --extensions=php,module,inc,install,test,profile,theme"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment