Created
June 22, 2014 14:38
-
-
Save chenyukang/9bbf1ef3be82fad7484f to your computer and use it in GitHub Desktop.
Emacs for Go
This file contains 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
;; golang | |
(add-to-list 'load-path "~/.emacs.d/go-mode") | |
(require 'go-mode) | |
(require 'go-mode-load) | |
(require 'go-autocomplete) | |
(require 'auto-complete-config) | |
(setq gofmt-command "goimports") | |
(load-file "~/.emacs.d/go-autocomplete.el") | |
(add-hook 'before-save-hook 'gofmt-before-save) | |
(add-hook 'go-mode-hook (lambda () | |
(local-set-key (kbd "C-c C-r") 'go-remove-unused-imports))) | |
(add-hook 'go-mode-hook (lambda () | |
(local-set-key (kbd "C-c C-r") 'go-remove-unused-imports))) | |
(defun run-cover () | |
"Run go coverage in tmp dir" | |
(interactive) | |
(let ((cmd (format "gocover %s" (buffer-file-name)))) | |
(shell-command cmd))) | |
(global-set-key (kbd "C-x g") 'run-cover) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment