Created
March 23, 2020 03:54
-
-
Save psanford/80d3268a666b2b11666313d452c054ed to your computer and use it in GitHub Desktop.
setup-lspmode-gopls-ubuntu1804.sh
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
sudo apt-get install -y emacs25-nox git | |
wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz | |
sudo tar -xf go1.14.1.linux-amd64.tar.gz -C /opt/ | |
export PATH=/opt/go/bin:$HOME/go/bin:$PATH | |
GO111MODULE=on go get golang.org/x/tools/gopls@latest | |
git clone https://github.com/psanford/wormhole-william | |
# fix elpa gpg (broken on default 18.04) | |
mkdir -p ~/.emacs.d/elpa/gnupg/ | |
gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40 | |
cat >> ~/.emacs.d/init.el <<EOF | |
;; enable melpa if it isn't enabled | |
(require 'package) | |
(when (not (assoc "melpa" package-archives)) | |
(setq package-archives (append '(("melpa" . "https://melpa.org/packages/")) package-archives))) | |
(package-initialize) | |
;; refresh package list if it is not already available | |
(when (not package-archive-contents) (package-refresh-contents)) | |
;; install use-package if it isn't already installed | |
(when (not (package-installed-p 'use-package)) | |
(package-install 'use-package)) | |
(use-package lsp-mode | |
:ensure t | |
:custom ( | |
;; suppress warning about not having yasnippet mode installed | |
(lsp-enable-snippet nil) | |
;; uncomment to enable gopls http debug server | |
;; (lsp-gopls-server-args '("-debug" "127.0.0.1:0")) | |
) | |
:commands (lsp lsp-deferred) | |
) | |
(use-package company | |
:ensure t | |
:config (progn | |
;; don't add any dely before trying to complete thing being typed | |
;; the call/response to gopls is asynchronous so this should have little | |
;; to no affect on edit latency | |
(setq company-idle-delay 0) | |
;; start completing after a single character instead of 3 | |
(setq company-minimum-prefix-length 1) | |
;; align fields in completions | |
(setq company-tooltip-align-annotations t) | |
) | |
) | |
;; hookup company to lsp-mode | |
(use-package company-lsp | |
:ensure t | |
:commands company-lsp) | |
(use-package go-mode | |
:ensure t | |
:hook ((go-mode . lsp-deferred))) | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can watch this here: https://asciinema.org/a/312582