Skip to content

Instantly share code, notes, and snippets.

@defp
Created August 17, 2020 15:32
Show Gist options
  • Save defp/12655bcd430dcbfc3f7aa1c591330f5b to your computer and use it in GitHub Desktop.
Save defp/12655bcd430dcbfc3f7aa1c591330f5b to your computer and use it in GitHub Desktop.
emacs init.el
(setenv "PATH" (concat (getenv "PATH") ":~/go/bin"))
;; Set up package.el to work with MELPA
(require 'package)
(setq package-archives '(("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
(package-initialize)
(package-refresh-contents)
(setq package-list '(evil go-mode company company-lsp company-go lsp-mode))
; install the missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
;; Enable Evil
(require 'evil)
(evil-mode 1)
(require 'lsp-mode)
(require 'company) ; load company mode
(require 'company-lsp)
(require 'company-go) ; load company mode go backend
(add-hook 'after-init-hook 'global-company-mode)
(push 'company-lsp company-backends)
(add-hook 'go-mode-hook (lambda ()
(set (make-local-variable 'company-backends) '(company-go))
(company-mode)))
(setq company-tooltip-limit 20) ; bigger popup window
(setq company-idle-delay .3) ; decrease delay before autocompletion popup shows
(setq company-echo-delay 0) ; remove annoying blinking
(setq company-begin-commands '(self-insert-command)) ; start
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(evil)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment