summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <martin.polden@gmail.com>2016-01-16 14:44:46 +0100
committerMartin Polden <martin.polden@gmail.com>2016-01-16 14:44:46 +0100
commit727148b7cf5965e01ff97d0a99d872db6f7292c6 (patch)
treed9045012fd9c3b9dc25dd3b29d10653cc609bd16
parente31e2e7e30ca2ce69692299696e9c446e520bcc0 (diff)
Add company-mode
-rw-r--r--init.el1
-rw-r--r--lisp/init-company-mode.el7
-rw-r--r--lisp/init-go-mode.el7
3 files changed, 15 insertions, 0 deletions
diff --git a/init.el b/init.el
index 05cda4b..67eb89d 100644
--- a/init.el
+++ b/init.el
@@ -10,6 +10,7 @@
(require 'init-ido)
(require 'init-projectile)
(require 'init-server)
+(require 'init-company-mode)
(require 'init-go-mode)
(require 'init-yaml-mode)
(require 'init-markdown-mode)
diff --git a/lisp/init-company-mode.el b/lisp/init-company-mode.el
new file mode 100644
index 0000000..012bb36
--- /dev/null
+++ b/lisp/init-company-mode.el
@@ -0,0 +1,7 @@
+;; install packages
+(require-packages '(company company-go))
+
+(require 'company)
+(require 'company-go)
+
+(provide 'init-company-mode)
diff --git a/lisp/init-go-mode.el b/lisp/init-go-mode.el
index 808d39b..2699080 100644
--- a/lisp/init-go-mode.el
+++ b/lisp/init-go-mode.el
@@ -41,6 +41,13 @@ items follow a style that is consistent with other prog-modes."
;; run gofmt before saving file
(add-hook 'before-save-hook 'gofmt-before-save)
+;; configure company-mode
+;; requires https://github.com/nsf/gocode for the backend
+(when (and (featurep 'company) (featurep 'company-go))
+ (add-hook 'go-mode-hook (lambda ()
+ (setq-local company-backends '(company-go))
+ (company-mode))))
+
;; use goimports if available
(when (executable-find "goimports")
(setq gofmt-command "goimports"))