Created
November 17, 2015 02:12
-
-
Save klizhentas/fb01554b3ab5ae8bc401 to your computer and use it in GitHub Desktop.
go plugins for emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ================== | |
; Go plugins | |
; ================== | |
(setenv "GOPATH" "/home/alex/go") | |
(setenv "GOROOT" "/opt/go") | |
(setenv "PATH" (concat (getenv "PATH") ":/home/alex/go/bin" ":/opt/go/bin" ":~/.emacs.d/goflymake")) | |
(setq exec-path (append exec-path (list (expand-file-name "~/.emacs.d/goflymake")))) | |
(require 'go-mode) | |
(require 'go-flymake) | |
(defun my-go-mode-hook () | |
; Use goimports instead of go-fmt | |
(setq gofmt-command "gofmt") | |
; Call Gofmt before saving | |
(add-hook 'before-save-hook 'gofmt-before-save) | |
; Customize compile command to run go build | |
(if (not (string-match "go" compile-command)) | |
(set (make-local-variable 'compile-command) | |
"go build -v && go test -v && go vet")) | |
; Godef jump key binding | |
(local-set-key (kbd "C-.") 'godef-jump)) | |
(add-hook 'go-mode-hook 'my-go-mode-hook) | |
(global-set-key (kbd "C-,") 'pop-tag-mark) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment