 (global-set-key (kbd "M-\\") 'delete-horizontal-space-across-lines)
 
 
-;; LANGUAGE CONFIGURATION
+;; LANGUAGE CONFIGURATION ;;
 
 ; Callow
 (add-to-list 'auto-mode-alist '("\\.clw\\'" . clojure-mode))
 
 ; Golang
-(require 'go-guru)                                   ; load guru
-
-;; https://johnsogg.github.io/emacs-golang
-;; Define function to call when go-mode loads
-(defun my-go-mode-hook ()
-  (add-hook 'before-save-hook 'gofmt-before-save) ; gofmt before every save
-  (setq gofmt-command "goimports")                ; gofmt uses invokes goimports
-  (if (not (string-match "go" compile-command))   ; set compile command default
-      (set (make-local-variable 'compile-command)
-	   "go build -v && go test -v && go vet"))
-
-  ;; ;; guru settings
-  ;; (go-guru-hl-identifier-mode)                    ; highlight identifiers
-
-  ;; ;; Key bindings specific to go-mode
-  ;; (local-set-key (kbd "M-.") 'godef-jump)         ; Go to definition
-  ;; (local-set-key (kbd "M-*") 'pop-tag-mark)       ; Return from whence you came
-  ;; (local-set-key (kbd "M-p") 'compile)            ; Invoke compiler
-  ;; (local-set-key (kbd "M-P") 'recompile)          ; Redo most recent compile cmd
-  ;; (local-set-key (kbd "M-]") 'next-error)         ; Go to next error (or msg)
-  ;; (local-set-key (kbd "M-[") 'previous-error)     ; Go to previous error or msg
-
-  ;; Misc go stuff
-  ;; (auto-complete-mode 1))                         ; Enable auto-complete mode
-  )
-
-;; Connect go-mode-hook with the function we just defined
-(add-hook 'go-mode-hook 'my-go-mode-hook)
-
-;;https://github.com/nsf/gocode/tree/master/emacs-company
-(require 'company)                                   ; load company mode
-(require 'company-go)                                ; load company mode go backend
-(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 autocompletion only after typing
-(add-hook 'go-mode-hook (lambda ()
-                          (set (make-local-variable 'company-backends) '(company-go))
-                          (company-mode)))
+
+; https://github.com/golang/tools/blob/master/gopls/doc/emacs.md
+(use-package lsp-mode
+  :init
+  (setq lsp-keymap-prefix "C-l"))
+(add-hook 'go-mode-hook #'lsp-deferred)
+
+;; Set up before-save hooks to format buffer and add/delete imports.
+;; Make sure you don't have other gofmt/goimports hooks enabled.
+(defun lsp-go-install-save-hooks ()
+  (add-hook 'before-save-hook #'lsp-format-buffer t t)
+  (add-hook 'before-save-hook #'lsp-organize-imports t t))
+(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
+
+
+;; OTHER ;;
+
 (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.
- '(company-preview ((t (:foreground "darkgray" :underline t))))
- '(company-preview-common ((t (:inherit company-preview))))
- '(company-tooltip ((t (:background "lightgray" :foreground "black"))))
- '(company-tooltip-common ((((type x)) (:inherit company-tooltip :weight bold)) (t (:inherit company-tooltip))))
- '(company-tooltip-common-selection ((((type x)) (:inherit company-tooltip-selection :weight bold)) (t (:inherit company-tooltip-selection))))
- '(company-tooltip-selection ((t (:background "steelblue" :foreground "white"))))
  '(org-tag ((t (:foreground "white" :weight bold)))))

     ("PROMISE" :foreground "cyan")))
 '(org-tags-column 0)
 '(package-selected-packages
   '(clojure-mode cider-eval-sexp-fu lua-mode markdown-preview-mode protobuf-mode cider go-guru company-go)))
; create the autosave dir if necessary, since emacs won't.
(make-directory "~/.emacs.d/autosaves/" t)


(setq org-log-done 'time)
(global-set-key "\C-cf" 'org-gcal-fetch)
(global-set-key "\C-ck" 'org-gcal-delete-at-point)
(setq org-highest-priority ?A)
(setq org-default-priority ?C)
(setq org-lowest-priority ?C)


;; WINDOW AND BUFFER MANAGEMENT ;;
