2015-02-03 20:22:48 +00:00
|
|
|
;;; packages.el --- PHP Layer packages File for Spacemacs
|
|
|
|
;;
|
2020-05-16 21:32:30 +00:00
|
|
|
;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
|
2015-02-03 20:22:48 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2019-12-06 18:59:15 +00:00
|
|
|
(defconst php-packages
|
|
|
|
'(
|
2020-04-18 11:26:47 +00:00
|
|
|
dap-mode
|
2019-12-06 18:59:15 +00:00
|
|
|
drupal-mode
|
|
|
|
eldoc
|
|
|
|
evil-matchit
|
|
|
|
flycheck
|
|
|
|
ggtags
|
|
|
|
counsel-gtags
|
|
|
|
helm-gtags
|
|
|
|
php-auto-yasnippets
|
|
|
|
(php-extras :location (recipe :fetcher github :repo "arnested/php-extras"))
|
|
|
|
php-mode
|
|
|
|
phpcbf
|
|
|
|
phpunit
|
|
|
|
(phpactor :toggle (not (eq php-backend 'lsp)))
|
|
|
|
(company-phpactor :requires company :toggle (not (eq php-backend 'lsp)))
|
|
|
|
(company-php :requires company :toggle (not (eq php-backend 'lsp)))
|
2020-05-16 21:32:30 +00:00
|
|
|
(geben :toggle (not (eq php-backend 'lsp)))))
|
2015-08-13 03:56:43 +00:00
|
|
|
|
2020-04-18 11:26:47 +00:00
|
|
|
(defun php/pre-init-dap-mode ()
|
2020-05-16 21:32:30 +00:00
|
|
|
(pcase php-backend
|
|
|
|
(`lsp (add-to-list 'spacemacs--dap-supported-modes 'php-mode)))
|
2020-04-18 11:26:47 +00:00
|
|
|
(add-hook 'php-mode-local-vars-hook #'spacemacs//php-setup-dap))
|
|
|
|
|
2015-04-22 04:34:55 +00:00
|
|
|
(defun php/init-drupal-mode ()
|
|
|
|
(use-package drupal-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-04-20 13:41:23 +00:00
|
|
|
|
2015-04-22 04:34:55 +00:00
|
|
|
(defun php/post-init-eldoc ()
|
2016-04-05 04:08:34 +00:00
|
|
|
(add-hook 'php-mode-hook 'eldoc-mode))
|
2015-04-22 04:34:55 +00:00
|
|
|
|
2015-09-10 02:30:12 +00:00
|
|
|
(defun php/post-init-flycheck ()
|
2017-02-14 03:27:29 +00:00
|
|
|
(spacemacs/enable-flycheck 'php-mode))
|
2015-09-10 02:30:12 +00:00
|
|
|
|
2015-04-22 04:34:55 +00:00
|
|
|
(defun php/post-init-ggtags ()
|
2016-08-15 19:24:44 +00:00
|
|
|
(add-hook 'php-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
2015-04-22 04:34:55 +00:00
|
|
|
|
2017-08-26 21:18:09 +00:00
|
|
|
(defun php/post-init-counsel-gtags ()
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'php-mode))
|
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun php/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'php-mode))
|
2015-04-22 04:34:55 +00:00
|
|
|
|
2019-09-27 11:35:29 +00:00
|
|
|
(defun php/post-init-evil-matchit ()
|
|
|
|
(add-hook 'php-mode-hook 'turn-on-evil-matchit-mode))
|
|
|
|
|
2015-04-22 04:34:55 +00:00
|
|
|
(defun php/init-php-auto-yasnippets ()
|
|
|
|
(use-package php-auto-yasnippets
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-04-20 13:41:23 +00:00
|
|
|
|
2015-08-13 03:56:43 +00:00
|
|
|
(defun php/init-php-extras ()
|
|
|
|
(use-package php-extras
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-08-13 03:56:43 +00:00
|
|
|
|
2015-04-22 04:34:55 +00:00
|
|
|
(defun php/init-php-mode ()
|
|
|
|
(use-package php-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2019-12-06 18:59:15 +00:00
|
|
|
:mode ("\\.php\\'" . php-mode)
|
2019-01-02 21:34:56 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2019-09-21 20:40:06 +00:00
|
|
|
(add-hook 'php-mode-hook 'spacemacs//php-setup-backend))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mg" "goto")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mt" "tests")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'php-mode
|
|
|
|
"tt" 'phpunit-current-test
|
|
|
|
"tc" 'phpunit-current-class
|
2019-12-06 18:59:15 +00:00
|
|
|
"tp" 'phpunit-current-project))))
|
2015-04-20 13:41:23 +00:00
|
|
|
|
2018-12-06 19:10:05 +00:00
|
|
|
(defun php/init-phpactor ()
|
|
|
|
(use-package phpactor
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mrg" "generate")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mre" "extract")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mrm" "methods")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mrc" "classes")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mrp" "properties")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mP" "phpactor")
|
2019-12-06 18:59:15 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "mr" "refactoring")
|
2018-12-06 19:10:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'php-mode
|
|
|
|
"ri" #'phpactor-import-class
|
2019-12-06 18:59:15 +00:00
|
|
|
"rr" #'phpactor-rename-variable-local
|
|
|
|
"rR" #'phpactor-rename-variable-file
|
2018-12-06 19:10:05 +00:00
|
|
|
"rn" #'phpactor-fix-namespace
|
|
|
|
"rv" #'phpactor-change-visibility
|
|
|
|
"rga" #'phpactor-generate-accessors
|
|
|
|
"rgm" #'phpactor-generate-method
|
|
|
|
"rcn" #'phpactor-create-new-class
|
|
|
|
"rcc" #'phpactor-copy-class
|
|
|
|
"rcm" #'phpactor-move-class
|
|
|
|
"rci" #'phpactor-inflect-class
|
|
|
|
"rpc" #'phpactor-complete-constructor
|
|
|
|
"rpp" #'phpactor-complete-properties
|
|
|
|
"rec" #'phpactor-extract-constant
|
|
|
|
"ree" #'phpactor-extract-expression
|
|
|
|
"rem" #'phpactor-extract-method
|
|
|
|
"rmc" #'phpactor-implement-contracts
|
|
|
|
"Ps" #'phpactor-status
|
|
|
|
"Pu" #'phpactor-install-or-update)
|
|
|
|
(setq-default phpactor-references-list-col1-width 72))))
|
|
|
|
|
2015-04-20 13:41:23 +00:00
|
|
|
(defun php/init-phpcbf ()
|
|
|
|
(use-package phpcbf
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-04-20 13:41:23 +00:00
|
|
|
|
|
|
|
(defun php/init-phpunit ()
|
|
|
|
(use-package phpunit
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2017-05-24 05:18:41 +00:00
|
|
|
|
2018-12-06 19:10:05 +00:00
|
|
|
(defun php/init-company-phpactor ()
|
|
|
|
(use-package company-phpactor
|
|
|
|
:defer t))
|
|
|
|
|
2017-05-26 08:40:06 +00:00
|
|
|
(defun php/init-company-php ()
|
2017-05-24 05:18:41 +00:00
|
|
|
(use-package company-php
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-05-24 05:18:41 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2018-06-01 06:59:57 +00:00
|
|
|
(add-to-list 'spacemacs-jump-handlers-php-mode 'ac-php-find-symbol-at-point)
|
2017-05-26 08:40:06 +00:00
|
|
|
(add-hook 'php-mode-hook 'ac-php-core-eldoc-setup)
|
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:modes php-mode
|
2018-12-06 19:10:05 +00:00
|
|
|
:backends (company-ac-php-backend company-phpactor)))))
|
|
|
|
|
|
|
|
(defun php/init-geben ()
|
|
|
|
(use-package geben
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(setq geben-temporary-file-directory (concat spacemacs-cache-directory "geben"))
|
|
|
|
|
|
|
|
(spacemacs/declare-prefix-for-mode 'php-mode "md" "debug")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'php-mode
|
|
|
|
"dx" #'geben
|
|
|
|
"dX" #'geben-end
|
|
|
|
"db" #'geben-add-current-line-to-predefined-breakpoints
|
|
|
|
"dC" #'geben-clear-predefined-breakpoints)
|
|
|
|
(evilified-state-evilify-map geben-mode-map
|
|
|
|
:mode 'php-mode
|
|
|
|
:bindings
|
|
|
|
"q" #'geben-stop
|
|
|
|
"n" #'geben-step-over
|
|
|
|
"s" #'geben-step-into
|
|
|
|
"r" #'geben-step-out
|
|
|
|
"L" #'geben-where
|
|
|
|
"v" #'geben-display-context
|
|
|
|
"c" #'geben-run-to-cursor
|
|
|
|
"bb" #'geben-set-breakpoint-line
|
|
|
|
"bc" #'geben-set-breakpoint-conditional
|
|
|
|
"be" #'geben-set-breakpoint-exception
|
|
|
|
"w" #'geben-show-backtrace
|
|
|
|
"gf" #'geben-find-file)
|
|
|
|
(add-hook 'geben-mode-hook 'evil-evilified-state)
|
|
|
|
(evil-set-initial-state 'geben-context-mode 'evilified)
|
|
|
|
(evilified-state-evilify-map geben-context-mode-map
|
|
|
|
:mode geben-context-mode
|
|
|
|
:bindings
|
|
|
|
"q" #'geben-quit-window
|
|
|
|
"j" #'widget-forward
|
|
|
|
"k" #'widget-backward
|
|
|
|
(kbd "<tab>") 'widget-button-press)
|
|
|
|
(evilified-state-evilify-map geben-backtrace-mode-map
|
|
|
|
:mode geben-backtrace-mode))))
|