dotfiles/emacs/.emacs.d/init/oni-php-mode-init.org

1.1 KiB

PHP

Turn on electric pairing in php-mode.

  (add-hook 'php-mode-hook 'electric-pair-local-mode)

Turn on electric indenting in php-mode.

  (add-hook 'php-mode-hook 'electric-indent-local-mode)

Enable flycheck in php-mode.

  (add-hook 'php-mode-hook 'flycheck-mode)

Reset require-final-newline because the default php-mode style disables it.

  (defun oni:set-require-final-newline ()
    (setq require-final-newline t))

  (add-hook 'php-mode-hook 'oni:set-require-final-newline)

Enable company mode for completion.

  (add-hook 'php-mode-hook 'company-mode)

Load a PHP-specific completion back-end when company mode is loaded.

  (eval-when-compile (require 'company))

  (with-eval-after-load 'company
    (require 'company-php)
    (add-to-list 'company-backends 'company-ac-php-backend))

Enable ggtags-mode for tags browsing with global.

  (add-hook 'php-mode-hook 'ggtags-mode)