From 5a08d8a96f9cc1983076028f24a1c418eb16b1dd Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 8 Apr 2018 17:08:28 -0700 Subject: [emacs] Fix (I think) the binding for hydra --- emacs.d/modules/module-docker.el | 3 ++- emacs.d/modules/module-go.el | 30 ++++++++++++++++++------------ emacs.d/modules/module-ivy.el | 4 +++- emacs.d/modules/module-json.el | 5 ++++- emacs.d/modules/module-pants.el | 3 ++- 5 files changed, 29 insertions(+), 16 deletions(-) (limited to 'emacs.d/modules') diff --git a/emacs.d/modules/module-docker.el b/emacs.d/modules/module-docker.el index 4583b0b..ba9cd57 100644 --- a/emacs.d/modules/module-docker.el +++ b/emacs.d/modules/module-docker.el @@ -1,7 +1,8 @@ (require 'config-package) (use-package dockerfile-mode - :bind ("C-z" . hybrdo-docker/body)) + :bind (:map dockerfile-mode-map + ("C-z" . hybrdo-docker/body))) (defhydra hydra-docker (:hint nil :exit t) " diff --git a/emacs.d/modules/module-go.el b/emacs.d/modules/module-go.el index 19f40db..6ac3484 100644 --- a/emacs.d/modules/module-go.el +++ b/emacs.d/modules/module-go.el @@ -2,7 +2,19 @@ (use-package go-mode :mode (("\\.go\\'" . go-mode)) - :bind ("C-z" . hydra-go/body)) + + :bind (:map go-mode-map + ("C-z" . hydra-go/body)) + + :init + (progn + (defun fcuny-go-set-tab-width () + (setq-local tab-width 2)) + (add-hook 'go-mode-hook 'fcuny-go-set-tab-width)) + + :config + (progn + (add-hook 'before-save-hook 'gofmt-before-save))) (use-package go-eldoc :config @@ -19,27 +31,21 @@ (use-package go-projectile) (use-package company-go + :init + (progn + (setq company-go-show-annotation t)) + :config (add-hook 'go-mode-hook (lambda() (add-to-list 'company-backends 'company-go)))) -(defun fc/my-go-hook () - (set (make-local-variable 'compile-command) - "go build -v && go test -v && go vet") - (setq-local tab-width 2)) - -(add-hook 'before-save-hook 'gofmt-before-save) -(add-hook 'go-mode-hook 'fc/my-go-hook) -(add-hook 'go-mode-hook 'company-mode) - (defhydra hydra-go (:hint nil :exit t) " ^Command^ ^Imports^ ^Doc^ ^-------^------^-------^-------^---^ _r_: run _ig_: goto _d_: doc at point -_g_: guru _ia_: add + _ia_: add ^ ^ _ir_: remove " - ("g" 'hydra-go-guru/body :color blue) ("r" go-run-main) ("d" godoc-at-point) ("ig" go-goto-imports ) diff --git a/emacs.d/modules/module-ivy.el b/emacs.d/modules/module-ivy.el index 438563d..8259921 100644 --- a/emacs.d/modules/module-ivy.el +++ b/emacs.d/modules/module-ivy.el @@ -15,6 +15,8 @@ :config (setq counsel-find-file-at-point t)) +(use-package counsel-projectile) + (use-package ivy :diminish (ivy-mode . "") @@ -49,6 +51,6 @@ ("c" projectile-compile-project "Compile project") ("r" projectile-remove-known-project "Remove project(s)")))) -(use-package counsel-projectile) +(use-package ivy-hydra) (provide 'module-ivy) diff --git a/emacs.d/modules/module-json.el b/emacs.d/modules/module-json.el index 40f46e5..279efb5 100644 --- a/emacs.d/modules/module-json.el +++ b/emacs.d/modules/module-json.el @@ -2,9 +2,12 @@ (use-package json-mode :mode "\\.json\\'" + :config (setq json-reformat:indent-width 2) - :bind ("C-z" . hydra-json/body)) + + :bind (:map json-mode-map + ("C-z" . hydra-json/body))) (defhydra hydra-json (:hint nil :exit t) " diff --git a/emacs.d/modules/module-pants.el b/emacs.d/modules/module-pants.el index f1027bb..85d7fec 100644 --- a/emacs.d/modules/module-pants.el +++ b/emacs.d/modules/module-pants.el @@ -11,7 +11,8 @@ :bind (("C-c b" . pants-find-build-file) ("C-c r" . pants-run-binary) - ("C-c t" . pants-run-test))) + ("C-c t" . pants-run-test) + ("C-c p" . hydra-pants/body))) (defhydra hydra-pants (:hint nil :exit t) " -- cgit 1.4.1