2015-05-20 21:06:46 +00:00
|
|
|
;;; packages.el --- Java Layer packages File for Spacemacs
|
|
|
|
;;
|
2017-01-06 03:51:13 +00:00
|
|
|
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
|
2015-05-20 21:06:46 +00:00
|
|
|
;;
|
|
|
|
;; Author: Lukasz Klich <klich.lukasz@gmail.com>
|
2016-01-12 02:40:54 +00:00
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
2015-05-20 21:06:46 +00:00
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2016-01-18 03:06:04 +00:00
|
|
|
(setq java-packages
|
|
|
|
'(
|
2017-02-09 22:22:38 +00:00
|
|
|
company
|
2017-01-02 05:39:04 +00:00
|
|
|
(company-emacs-eclim :toggle
|
2017-07-02 13:48:06 +00:00
|
|
|
(configuration-layer/package-used-p 'company))
|
2016-08-17 22:16:44 +00:00
|
|
|
eclim
|
2017-02-09 22:22:38 +00:00
|
|
|
eldoc
|
2017-02-09 21:45:27 +00:00
|
|
|
ensime
|
2017-02-09 22:22:38 +00:00
|
|
|
flycheck
|
|
|
|
(flycheck-eclim :location local
|
2017-07-03 07:52:54 +00:00
|
|
|
:requires flycheck)
|
2017-02-09 22:22:38 +00:00
|
|
|
flyspell
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
2017-02-09 22:20:56 +00:00
|
|
|
gradle-mode
|
2017-08-26 21:18:09 +00:00
|
|
|
counsel-gtags
|
2016-04-05 04:08:34 +00:00
|
|
|
helm-gtags
|
2017-02-09 21:45:27 +00:00
|
|
|
(java-mode :location built-in)
|
2017-12-17 23:39:55 +00:00
|
|
|
maven-test-mode
|
2017-02-09 22:22:38 +00:00
|
|
|
(meghanada :toggle (not (version< emacs-version "25.1")))
|
2017-12-17 23:39:55 +00:00
|
|
|
mvn
|
2017-02-09 21:45:27 +00:00
|
|
|
))
|
2015-05-20 21:06:46 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
(defun java/post-init-company ()
|
|
|
|
(add-hook 'java-mode-local-vars-hook #'spacemacs//java-setup-company))
|
|
|
|
|
2016-08-29 14:04:54 +00:00
|
|
|
(defun java/init-company-emacs-eclim ()
|
|
|
|
(use-package company-emacs-eclim
|
|
|
|
:defer t
|
2017-01-02 05:39:04 +00:00
|
|
|
:init
|
2017-02-09 22:22:38 +00:00
|
|
|
(setq company-emacs-eclim-ignore-case nil)
|
|
|
|
;; see `spacemacs//java-setup-eclim-company'
|
2017-02-15 04:22:29 +00:00
|
|
|
))
|
2016-11-14 22:09:54 +00:00
|
|
|
|
2016-08-17 22:16:44 +00:00
|
|
|
(defun java/init-eclim ()
|
2015-05-20 21:06:46 +00:00
|
|
|
(use-package eclim
|
2015-07-04 04:20:12 +00:00
|
|
|
:defer t
|
2017-02-15 04:22:29 +00:00
|
|
|
;; :init (setq eclim-auto-save nil)
|
2015-05-20 21:06:46 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2017-02-13 13:38:37 +00:00
|
|
|
(spacemacs|hide-lighter eclim-mode)
|
2016-08-03 21:53:00 +00:00
|
|
|
(require 'eclimd)
|
2017-02-09 22:22:38 +00:00
|
|
|
;; enable help at point
|
2015-07-04 04:20:12 +00:00
|
|
|
(setq help-at-pt-display-when-idle t
|
|
|
|
help-at-pt-timer-delay 0.1)
|
2015-05-20 21:06:46 +00:00
|
|
|
(help-at-pt-set-timer)
|
|
|
|
(add-to-list 'minor-mode-alist
|
2015-07-04 04:20:12 +00:00
|
|
|
'(eclim-mode (:eval (eclim-modeline-string))))
|
2017-02-09 22:22:38 +00:00
|
|
|
;; hack to support Maven multi-modules
|
|
|
|
(defun my-eclim-fix-relative-path (path)
|
|
|
|
(replace-regexp-in-string "^.*src/" "src/" path))
|
|
|
|
(advice-add 'eclim--project-current-file :filter-return
|
|
|
|
#'my-eclim-fix-relative-path)
|
|
|
|
;; key bindings
|
|
|
|
(dolist (prefix '(("ma" . "ant")
|
|
|
|
("mD" . "daemon")
|
|
|
|
("mg" . "goto")
|
|
|
|
("mh" . "help/doc")
|
|
|
|
("mi" . "issues")
|
|
|
|
("mp" . "project")
|
|
|
|
("mr" . "refactor")
|
|
|
|
("mt" . "test")))
|
|
|
|
(spacemacs/declare-prefix-for-mode
|
|
|
|
'java-mode (car prefix) (cdr prefix)))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'java-mode
|
|
|
|
;; ant
|
|
|
|
"aa" 'eclim-ant-run
|
|
|
|
"ac" 'eclim-ant-clear-cache
|
|
|
|
"ar" 'eclim-ant-run
|
|
|
|
"av" 'eclim-ant-validate
|
|
|
|
;; daemon
|
|
|
|
"Dk" 'stop-eclimd
|
|
|
|
"Ds" 'start-eclimd
|
|
|
|
;; errors (problems)
|
2017-02-15 04:22:29 +00:00
|
|
|
"ee" 'eclim-problems-correct
|
2017-02-09 22:22:38 +00:00
|
|
|
;; find
|
|
|
|
"ff" 'eclim-java-find-generic
|
|
|
|
;; goto
|
|
|
|
"gt" 'eclim-java-find-type
|
|
|
|
;; help/doc
|
|
|
|
"hc" 'eclim-java-call-hierarchy
|
|
|
|
"hh" 'eclim-java-show-documentation-for-current-element
|
|
|
|
"hi" 'eclim-java-hierarchy
|
|
|
|
"hu" 'eclim-java-find-references
|
|
|
|
;; project
|
|
|
|
"pb" 'eclim-project-build
|
|
|
|
"pc" 'eclim-project-create
|
|
|
|
"pd" 'eclim-project-delete
|
|
|
|
"pg" 'eclim-project-goto
|
|
|
|
"pi" 'eclim-project-import
|
|
|
|
"pj" 'eclim-project-info-mode
|
|
|
|
"pk" 'eclim-project-close
|
|
|
|
"po" 'eclim-project-open
|
|
|
|
"pp" 'eclim-project-mode
|
2015-11-17 21:29:48 +00:00
|
|
|
"pr" 'eclim-java-run-run
|
2017-02-09 22:22:38 +00:00
|
|
|
"pu" 'eclim-project-update
|
|
|
|
;; refactor
|
|
|
|
"rc" 'eclim-java-constructor
|
|
|
|
"rf" 'eclim-java-format
|
2017-07-08 22:11:52 +00:00
|
|
|
"rg" 'eclim-java-generate-getter-and-setter
|
2017-02-09 22:22:38 +00:00
|
|
|
"ri" 'eclim-java-import-organize
|
|
|
|
"rj" 'eclim-java-implement
|
2017-06-11 17:15:23 +00:00
|
|
|
"rn" 'eclim-java-new
|
2017-02-09 22:22:38 +00:00
|
|
|
"rr" 'eclim-java-refactor-rename-symbol-at-point
|
|
|
|
;; test
|
|
|
|
"tt" 'eclim-run-junit)
|
2015-05-20 21:06:46 +00:00
|
|
|
(evil-define-key 'insert java-mode-map
|
2017-02-09 22:22:38 +00:00
|
|
|
(kbd ".") 'spacemacs/java-eclim-completing-dot
|
|
|
|
(kbd ":") 'spacemacs/java-eclim-completing-double-colon
|
2015-05-20 21:06:46 +00:00
|
|
|
(kbd "M-.") 'eclim-java-find-declaration
|
|
|
|
(kbd "M-,") 'pop-tag-mark
|
|
|
|
(kbd "M-<mouse-3>") 'eclim-java-find-declaration
|
|
|
|
(kbd "<mouse-8>") 'pop-tag-mark)
|
|
|
|
(evil-define-key 'normal java-mode-map
|
|
|
|
(kbd "M-.") 'eclim-java-find-declaration
|
|
|
|
(kbd "M-,") 'pop-tag-mark
|
|
|
|
(kbd "M-<mouse-3>") 'eclim-java-find-declaration
|
|
|
|
(kbd "<mouse-8>") 'pop-tag-mark)
|
|
|
|
(evil-define-key 'normal eclim-problems-mode-map
|
|
|
|
(kbd "a") 'eclim-problems-show-all
|
|
|
|
(kbd "e") 'eclim-problems-show-errors
|
|
|
|
(kbd "g") 'eclim-problems-buffer-refresh
|
|
|
|
(kbd "q") 'eclim-quit-window
|
|
|
|
(kbd "w") 'eclim-problems-show-warnings
|
|
|
|
(kbd "f") 'eclim-problems-toggle-filefilter
|
|
|
|
(kbd "c") 'eclim-problems-correct
|
|
|
|
(kbd "RET") 'eclim-problems-open-current)
|
|
|
|
(evil-define-key 'normal eclim-project-mode-map
|
|
|
|
(kbd "N") 'eclim-project-create
|
|
|
|
(kbd "m") 'eclim-project-mark-current
|
|
|
|
(kbd "M") 'eclim-project-mark-all
|
|
|
|
(kbd "u") 'eclim-project-unmark-current
|
|
|
|
(kbd "U") 'eclim-project-unmark-all
|
|
|
|
(kbd "o") 'eclim-project-open
|
|
|
|
(kbd "c") 'eclim-project-close
|
|
|
|
(kbd "i") 'eclim-project-info-mode
|
|
|
|
(kbd "I") 'eclim-project-import
|
|
|
|
(kbd "RET") 'eclim-project-goto
|
|
|
|
(kbd "D") 'eclim-project-delete
|
|
|
|
(kbd "p") 'eclim-project-update
|
|
|
|
(kbd "g") 'eclim-project-mode-refresh
|
|
|
|
(kbd "R") 'eclim-project-rename
|
2015-11-17 21:29:48 +00:00
|
|
|
(kbd "q") 'eclim-quit-window))))
|
2015-05-20 21:06:46 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
(defun java/post-init-eldoc ()
|
|
|
|
(add-hook 'java-mode-local-vars-hook #'spacemacs//java-setup-eldoc))
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
(defun java/init-ensime ()
|
|
|
|
(use-package ensime
|
|
|
|
:defer t
|
|
|
|
:commands ensime-mode
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq ensime-startup-dirname (concat spacemacs-cache-directory "ensime/"))
|
|
|
|
(spacemacs/register-repl 'ensime 'ensime-inf-switch "ensime"))
|
|
|
|
:config
|
|
|
|
(progn
|
2017-06-21 08:05:56 +00:00
|
|
|
;; This function was renamed in ensime. Usually we don't need to do this,
|
|
|
|
;; but documentation recommends the stable version of ensime, so we must
|
|
|
|
;; try to support it, too.
|
|
|
|
(unless (fboundp 'ensime-type-at-point)
|
|
|
|
(defalias 'ensime-type-at-point 'ensime-print-type-at-point))
|
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
;; key bindings
|
|
|
|
(dolist (mode java--ensime-modes)
|
|
|
|
(dolist (prefix '(("mb" . "build")
|
|
|
|
("mc" . "check")
|
|
|
|
("md" . "debug")
|
|
|
|
("mD" . "daemon")
|
|
|
|
("me" . "errors")
|
|
|
|
("mg" . "goto")
|
|
|
|
("mh" . "docs")
|
|
|
|
("mi" . "inspect")
|
|
|
|
("mr" . "refactor")
|
|
|
|
("mt" . "test")
|
|
|
|
("ms" . "repl")
|
|
|
|
("my" . "yank")))
|
|
|
|
(spacemacs/declare-prefix-for-mode mode (car prefix) (cdr prefix)))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"/" 'ensime-search
|
|
|
|
"'" 'ensime-inf-switch
|
2016-08-03 21:53:00 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"bc" 'ensime-sbt-do-compile
|
|
|
|
"bC" 'ensime-sbt-do-clean
|
|
|
|
"bi" 'ensime-sbt-switch
|
|
|
|
"bp" 'ensime-sbt-do-package
|
|
|
|
"br" 'ensime-sbt-do-run
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"ct" 'ensime-typecheck-current-buffer
|
|
|
|
"cT" 'ensime-typecheck-all
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"dA" 'ensime-db-attach
|
|
|
|
"db" 'ensime-db-set-break
|
|
|
|
"dB" 'ensime-db-clear-break
|
|
|
|
"dC" 'ensime-db-clear-all-breaks
|
|
|
|
"dc" 'ensime-db-continue
|
|
|
|
"di" 'ensime-db-inspect-value-at-point
|
|
|
|
"dn" 'ensime-db-next
|
|
|
|
"do" 'ensime-db-step-out
|
|
|
|
"dq" 'ensime-db-quit
|
|
|
|
"dr" 'ensime-db-run
|
|
|
|
"ds" 'ensime-db-step
|
|
|
|
"dt" 'ensime-db-backtrace
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"Df" 'ensime-reload-open-files
|
|
|
|
"Dr" 'spacemacs/ensime-gen-and-restart
|
|
|
|
"Ds" 'ensime
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"ee" 'ensime-print-errors-at-point
|
|
|
|
"el" 'ensime-show-all-errors-and-warnings
|
|
|
|
"es" 'ensime-stacktrace-switch
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"gp" 'ensime-pop-find-definition-stack
|
|
|
|
"gi" 'ensime-goto-impl
|
|
|
|
"gt" 'ensime-goto-test
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"hh" 'ensime-show-doc-for-symbol-at-point
|
|
|
|
"hT" 'ensime-type-at-point-full-name
|
|
|
|
"ht" 'ensime-type-at-point
|
|
|
|
"hu" 'ensime-show-uses-of-symbol-at-point
|
|
|
|
|
|
|
|
"ii" 'ensime-inspect-type-at-point
|
|
|
|
"iI" 'ensime-inspect-type-at-point-other-frame
|
|
|
|
"ip" 'ensime-inspect-project-package
|
|
|
|
|
|
|
|
"ra" 'ensime-refactor-add-type-annotation
|
|
|
|
"rd" 'ensime-refactor-diff-inline-local
|
|
|
|
"rD" 'ensime-undo-peek
|
|
|
|
"rf" 'ensime-format-source
|
|
|
|
"ri" 'ensime-refactor-diff-organize-imports
|
|
|
|
"rm" 'ensime-refactor-diff-extract-method
|
|
|
|
"rr" 'ensime-refactor-diff-rename
|
|
|
|
"rt" 'ensime-import-type-at-point
|
|
|
|
"rv" 'ensime-refactor-diff-extract-local
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
"ta" 'ensime-sbt-do-test-dwim
|
|
|
|
"tr" 'ensime-sbt-do-test-quick-dwim
|
|
|
|
"tt" 'ensime-sbt-do-test-only-dwim
|
|
|
|
|
|
|
|
"sa" 'ensime-inf-load-file
|
|
|
|
"sb" 'ensime-inf-eval-buffer
|
|
|
|
"sB" 'spacemacs/ensime-inf-eval-buffer-switch
|
|
|
|
"si" 'ensime-inf-switch
|
|
|
|
"sr" 'ensime-inf-eval-region
|
|
|
|
"sR" 'spacemacs/ensime-inf-eval-region-switch
|
|
|
|
|
|
|
|
"yT" 'spacemacs/ensime-yank-type-at-point-full-name
|
|
|
|
"yt" 'spacemacs/ensime-yank-type-at-point
|
|
|
|
|
|
|
|
"z" 'ensime-expand-selection-command))
|
|
|
|
(evil-define-key 'insert ensime-mode-map
|
|
|
|
(kbd ".") 'spacemacs/ensime-completing-dot
|
|
|
|
(kbd "M-.") 'ensime-edit-definition
|
|
|
|
(kbd "M-,") 'ensime-pop-find-definition-stack)
|
|
|
|
(evil-define-key 'normal ensime-mode-map
|
|
|
|
(kbd "M-.") 'ensime-edit-definition
|
|
|
|
(kbd "M-,") 'ensime-pop-find-definition-stack)
|
|
|
|
(evil-define-key 'normal ensime-popup-buffer-map
|
|
|
|
(kbd "q") 'ensime-popup-buffer-quit-function)
|
|
|
|
(evil-define-key 'normal ensime-inspector-mode-map
|
|
|
|
(kbd "q") 'ensime-popup-buffer-quit-function)
|
|
|
|
(evil-define-key 'normal ensime-refactor-info-map
|
|
|
|
(kbd "q") 'spacemacs/ensime-refactor-cancel
|
|
|
|
(kbd "c") 'spacemacs/ensime-refactor-accept
|
|
|
|
(kbd "RET") 'spacemacs/ensime-refactor-accept)
|
|
|
|
(evil-define-key 'normal ensime-compile-result-map
|
|
|
|
(kbd "g") 'ensime-show-all-errors-and-warnings
|
|
|
|
(kbd "TAB") 'forward-button
|
|
|
|
(kbd "<backtab>") 'backward-button
|
|
|
|
(kbd "M-n") 'forward-button
|
|
|
|
(kbd "M-p") 'backward-button
|
|
|
|
(kbd "n") 'forward-button
|
2017-04-18 17:01:19 +00:00
|
|
|
(kbd "N") 'backward-button)
|
|
|
|
(evil-define-key '(insert normal) ensime-search-mode-map
|
|
|
|
(kbd "C-q") 'ensime-search-quit
|
|
|
|
(kbd "C-j") 'ensime-search-next-match
|
|
|
|
(kbd "C-k") 'ensime-search-prev-match
|
|
|
|
(kbd "RET") 'ensime-search-choose-current-result
|
|
|
|
(kbd "C-i") 'ensime-search-insert-import-of-current-result))))
|
2017-02-09 22:22:38 +00:00
|
|
|
|
|
|
|
;; (defun java/post-init-ensime ()
|
|
|
|
;; (when (eq 'ensime java-backend)
|
|
|
|
;; (use-package ensime
|
|
|
|
;; :defer t
|
|
|
|
;; :init
|
|
|
|
;; (progn
|
|
|
|
;; (spacemacs//ensime-init 'java-mode t nil)
|
2017-07-02 13:48:06 +00:00
|
|
|
;; (when (configuration-layer/package-used-p 'company)
|
2017-02-09 22:22:38 +00:00
|
|
|
;; (push 'ensime-company company-backends-java-mode)))
|
|
|
|
;; :config
|
|
|
|
;; (progn
|
|
|
|
;; (spacemacs/ensime-configure-keybindings 'java-mode)))))
|
|
|
|
|
|
|
|
(defun java/post-init-flycheck ()
|
|
|
|
(add-hook 'java-mode-local-vars-hook #'spacemacs//java-setup-flycheck))
|
|
|
|
|
|
|
|
(defun java/init-flycheck-eclim ()
|
|
|
|
(use-package flycheck-eclim
|
|
|
|
:commands flycheck-eclim-setup
|
|
|
|
;; see `spacemacs//java-setup-eclim-flycheck'
|
|
|
|
))
|
|
|
|
|
|
|
|
(defun java/post-init-flyspell ()
|
|
|
|
(add-hook 'java-mode-local-vars-hook #'spacemacs//java-setup-flyspell))
|
2015-05-20 21:06:46 +00:00
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun java/post-init-ggtags ()
|
2016-08-15 19:24:44 +00:00
|
|
|
(add-hook 'java-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
2017-02-09 22:20:56 +00:00
|
|
|
(defun java/init-gradle-mode ()
|
|
|
|
(use-package gradle-mode
|
2017-12-17 23:39:55 +00:00
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(when (configuration-layer/package-used-p 'groovy-mode)
|
|
|
|
(add-hook 'groovy-mode-hook 'gradle-mode)
|
|
|
|
(spacemacs/declare-prefix-for-mode 'groovy-mode "ml" "gradle")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'groovy-mode "mc" "compile")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'groovy-mode "mlt" "tests"))
|
|
|
|
(when (configuration-layer/package-used-p 'java-mode)
|
|
|
|
(add-hook 'java-mode-hook 'gradle-mode)
|
|
|
|
(spacemacs/declare-prefix-for-mode 'java-mode "ml" "gradle")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'groovy-mode "mc" "compile")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'java-mode "mlt" "tests")))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs|hide-lighter gradle-mode)
|
|
|
|
(spacemacs/set-leader-keys-for-minor-mode 'gradle-mode
|
|
|
|
"lcc" 'gradle-build
|
|
|
|
"lcC" 'spacemacs/gradle-clean
|
|
|
|
"lcr" 'spacemacs/gradle-clean-build
|
|
|
|
"lta" 'gradle-test
|
|
|
|
"ltb" 'spacemacs/gradle-test-buffer
|
|
|
|
"ltt" 'gradle-single-test
|
|
|
|
"lx" 'gradle-execute))))
|
2017-02-09 22:20:56 +00:00
|
|
|
|
2017-08-26 21:18:09 +00:00
|
|
|
(defun java/post-init-counsel-gtags ()
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'java-mode))
|
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun java/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'java-mode))
|
|
|
|
|
2016-04-03 04:12:28 +00:00
|
|
|
(defun java/init-java-mode ()
|
2017-02-09 22:22:22 +00:00
|
|
|
(use-package java-mode
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(add-hook 'java-mode-local-vars-hook #'spacemacs//java-setup-backend)
|
2017-02-09 22:22:38 +00:00
|
|
|
(put 'java-backend 'safe-local-variable 'symbolp)
|
2017-02-09 22:22:22 +00:00
|
|
|
(spacemacs//java-define-command-prefixes))))
|
|
|
|
|
2017-12-17 23:39:55 +00:00
|
|
|
(defun java/init-maven-test-mode ()
|
|
|
|
(use-package maven-test-mode
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(when (configuration-layer/package-used-p 'java-mode)
|
|
|
|
(add-hook 'java-mode-hook 'maven-test-mode)
|
|
|
|
(spacemacs/declare-prefix-for-mode 'java-mode "mm" "maven")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'java-mode "mmg" "goto")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'java-mode "mmt" "tests"))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs|hide-lighter maven-test-mode)
|
|
|
|
(spacemacs/set-leader-keys-for-minor-mode 'maven-test-mode
|
|
|
|
"mga" 'maven-test-toggle-between-test-and-class
|
|
|
|
"mgA" 'maven-test-toggle-between-test-and-class-other-window
|
|
|
|
"mta" 'maven-test-all
|
|
|
|
"mtC-a" 'maven-test-clean-test-all
|
|
|
|
"mtb" 'maven-test-file
|
|
|
|
"mti" 'maven-test-install
|
|
|
|
"mtt" 'maven-test-method))))
|
|
|
|
|
2017-02-09 22:22:38 +00:00
|
|
|
(defun java/init-meghanada ()
|
|
|
|
(use-package meghanada
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq meghanada-server-install-dir (concat spacemacs-cache-directory
|
|
|
|
"meghanada/")
|
|
|
|
company-meghanada-prefix-length 1
|
|
|
|
;; let spacemacs handle company and flycheck itself
|
|
|
|
meghanada-use-company nil
|
|
|
|
meghanada-use-flycheck nil))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
;; key bindings
|
2017-04-13 21:01:22 +00:00
|
|
|
(dolist (prefix '(("mc" . "compile")
|
2017-02-09 22:22:38 +00:00
|
|
|
("mD" . "daemon")
|
|
|
|
("mg" . "goto")
|
|
|
|
("mr" . "refactor")
|
|
|
|
("mt" . "test")
|
|
|
|
("mx" . "execute")))
|
|
|
|
(spacemacs/declare-prefix-for-mode
|
|
|
|
'java-mode (car prefix) (cdr prefix)))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'java-mode
|
|
|
|
"cb" 'meghanada-compile-file
|
|
|
|
"cc" 'meghanada-compile-project
|
|
|
|
|
|
|
|
"Dc" 'meghanada-client-direct-connect
|
|
|
|
"Dd" 'meghanada-client-disconnect
|
|
|
|
"Di" 'meghanada-install-server
|
|
|
|
"Dk" 'meghanada-server-kill
|
|
|
|
"Dl" 'meghanada-clear-cache
|
|
|
|
"Dp" 'meghanada-ping
|
|
|
|
"Dr" 'meghanada-restart
|
|
|
|
"Ds" 'meghanada-client-connect
|
|
|
|
"Du" 'meghanada-update-server
|
|
|
|
"Dv" 'meghanada-version
|
|
|
|
|
|
|
|
"gb" 'meghanada-back-jump
|
|
|
|
|
|
|
|
"=" 'meghanada-code-beautify
|
|
|
|
"ri" 'meghanada-optimize-import
|
|
|
|
"rI" 'meghanada-import-all
|
|
|
|
|
|
|
|
"ta" 'meghanada--run-junit
|
|
|
|
"tc" 'meghanada-run-junit-class
|
|
|
|
"tl" 'meghanada-run-junit-recent
|
|
|
|
"tt" 'meghanada-run-junit-test-case
|
|
|
|
|
|
|
|
;; meghanada-switch-testcase
|
|
|
|
;; meghanada-local-variable
|
|
|
|
|
|
|
|
"x:" 'meghanada-run-task))))
|
2017-12-17 23:39:55 +00:00
|
|
|
|
|
|
|
(defun java/init-mvn ()
|
|
|
|
(use-package mvn
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(when (configuration-layer/package-used-p 'java-mode)
|
|
|
|
(spacemacs/declare-prefix-for-mode 'java-mode "mm" "maven")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'java-mode "mmc" "compile")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'java-mode
|
|
|
|
"mcc" 'mvn-compile
|
|
|
|
"mcC" 'mvn-clean
|
|
|
|
"mcr" 'spacemacs/mvn-clean-compile))))
|