summary refs log tree commit diff
path: root/emacs.d/custom
diff options
context:
space:
mode:
Diffstat (limited to 'emacs.d/custom')
-rw-r--r--emacs.d/custom/fcuny-company.el12
-rw-r--r--emacs.d/custom/fcuny-go.el28
-rw-r--r--emacs.d/custom/fcuny-ui.el3
3 files changed, 36 insertions, 7 deletions
diff --git a/emacs.d/custom/fcuny-company.el b/emacs.d/custom/fcuny-company.el
new file mode 100644
index 0000000..4ffc900
--- /dev/null
+++ b/emacs.d/custom/fcuny-company.el
@@ -0,0 +1,12 @@
+(use-package company
+  :ensure t
+  :diminish company-mode)
+
+(use-package company-go
+  :ensure t
+  :after (company)
+  :hook (go-mode . (lambda ()
+                     (setq-local company-backends
+                                 (append (list 'company-go) company-backends)))))
+
+(provide 'fcuny-company)
diff --git a/emacs.d/custom/fcuny-go.el b/emacs.d/custom/fcuny-go.el
index 75bd042..cd0c05f 100644
--- a/emacs.d/custom/fcuny-go.el
+++ b/emacs.d/custom/fcuny-go.el
@@ -1,13 +1,14 @@
 (use-package go-mode
   :ensure t
-  :after (exec-path-from-shell flycheck flyspell)
-  :hook (go-mode . fcuny/go-mode-setup)
-  :bind (("M-?" . godoc-at-point)
-         ("M-." . godef-jump)
-         ;; Jump back after godef-jump
-         ("M-*" . pop-tag-mark))
+  :after (exec-path-from-shell flycheck flyspell company company-go hydra)
+  :hook ((go-mode . fcuny/go-mode-setup)
+         (go-mode . company-mode))
+  :bind (("C-c a ?" . godoc-at-point)
+         ("C-c a ." . godef-jump)
+         ("C-c a a" . go-import-add))
   :custom
   (godoc-use-completing-read t)
+  (gofmt-command "goimports")
   ;; see https://github.com/dominikh/go-mode.el/issues/262
   (godoc-at-point-function 'godoc-gogetdoc)
   :init
@@ -16,7 +17,16 @@
     (add-hook 'before-save-hook 'gofmt-before-save))
   :config
   (when (memq window-system '(mac ns))
-    (exec-path-from-shell-copy-env "GOPATH")))
+    (exec-path-from-shell-copy-env "GOPATH"))
+  (defhydra go-hydra (:color teal :columns 3)
+    "Go"
+    ("r" go-guru-referrers "referrers")
+    ("i" go-guru-implements "implements")
+    ("d" go-guru-definition "definition")
+    ("D" go-guru-describe "describe")
+    ("t" go-test-current-test "run this test")
+    ("f" go-test-current-file "run tests for this file"))
+  (define-key go-mode-map (kbd "C-c g") 'go-hydra/body))
 
 (use-package go-guru
   :ensure t
@@ -40,4 +50,8 @@
   :ensure t
   :after go-mode)
 
+(use-package gotest
+  :ensure t
+  :after go-mode)
+
 (provide 'fcuny-go)
diff --git a/emacs.d/custom/fcuny-ui.el b/emacs.d/custom/fcuny-ui.el
index e466a36..e5b9356 100644
--- a/emacs.d/custom/fcuny-ui.el
+++ b/emacs.d/custom/fcuny-ui.el
@@ -36,4 +36,7 @@
 ;; Adaptive cursor width shows width of character, e.g. TAB.
 (setq x-stretch-cursor t)
 
+(use-package hydra
+  :ensure t)
+
 (provide 'fcuny-ui)