Improve go-mode support

This commit is contained in:
Henrik Lissner 2015-09-25 23:14:48 -04:00
parent de5e498a77
commit b580ffdb8a
2 changed files with 24 additions and 2 deletions

4
Cask
View file

@ -132,6 +132,9 @@
;; C#
(depends-on "csharp-mode")
(depends-on "omnisharp")
;; Golang
(depends-on "go-mode")
(depends-on "go-eldoc")
;; Java
(depends-on "emacs-eclim")
(depends-on "groovy-mode")
@ -144,7 +147,6 @@
;;(depends-on "org-plus-contrib")
;;(depends-on "org-opml" :git "https://github.com/edavis/org-opml")
;; Other
(depends-on "go-mode")
(depends-on "swift-mode")
(depends-on "vimrc-mode")
(depends-on "crystal-mode" :git "https://github.com/jpellerin/emacs-crystal-mode/")

View file

@ -3,8 +3,28 @@
(use-package go-mode
:mode "\\.go$"
:interpreter "go"
:init (add-hook! go-mode 'emr-initialize)
:config
(bind! :map go-mode-map :n "gd" 'godef-jump)
(bind! :map go-mode-map
:n "gd" 'godef-jump
:n "gD" 'godef-describe)
(mapc (lambda (x)
(let ((command-name (car x))
(title (cadr x))
(region-p (caddr x))
predicate)
(setq predicate (cond ((eq region-p 'both) nil)
(t (if region-p
(lambda () (use-region-p))
(lambda () (not (use-region-p)))))))
(emr-declare-command (intern (symbol-name command-name))
:title title :modes 'go-mode :predicate predicate)))
'((go-remove-unused-imports "Remove unushed imports" nil)
(gofmt "Format code" nil)))
(use-package go-eldoc
:config (add-hook! go-mode 'go-eldoc-setup))
(use-package company-go
:config