go-mode: hooks to call goimport/fmt
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sun, 22 Nov 2015 01:26:28 +0000 (06:56 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sun, 22 Nov 2015 01:26:28 +0000 (06:56 +0530)
init.el

diff --git a/init.el b/init.el
index 9442590529e460ea2d50f457ac52d920cbc688d4..983217e07584f2f484d972c3f4ecf7daac016249 100644 (file)
--- a/init.el
+++ b/init.el
 ;; auto complete
 (ac-config-default)
 (ac-linum-workaround)
+
+;; highlight todo
+(add-hook 'prog-mode-hook 'highlight-todos)
+
+;; Ledger
+(setq ledger-binary-path "~/.cabal/bin/hledger")
+
+;; golang
+(setq exec-path (cons "/usr/local/go/bin" exec-path))
+(add-to-list 'exec-path (concat (getenv "GOPATH") "/bin"))
+
+(defun go-mode-setup ()
+  (go-eldoc-setup)
+  (setq gofmt-command "goimports")
+  (add-hook 'before-save-hook 'gofmt-before-save))
+
+(add-hook 'go-mode-hook 'go-mode-setup)