From 727148b7cf5965e01ff97d0a99d872db6f7292c6 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Sat, 16 Jan 2016 14:44:46 +0100 Subject: Add company-mode --- init.el | 1 + lisp/init-company-mode.el | 7 +++++++ lisp/init-go-mode.el | 7 +++++++ 3 files changed, 15 insertions(+) create mode 100644 lisp/init-company-mode.el 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")) -- cgit v1.2.3