summaryrefslogtreecommitdiffstats
path: root/lisp/init-lsp-mode.el
blob: eccda79a1f0377c956492894b0259c5ee1764275 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(defun organize-imports-and-format ()
  (interactive)
  (lsp-organize-imports)
  (lsp-format-buffer))

(use-package lsp-mode
  :commands (lsp lsp-format-buffer)
  :init
  ;; disable yasnippet support
  (setq lsp-enable-snippet nil)
  :hook
  ;; enable lsp in go-mode
  ((go-mode . lsp))
  :bind (:map lsp-mode-map
              ;; C-c r renames identifier
              ("C-c r" . lsp-rename)
              ;; C-c p organizes imports and reformats buffer
              ("C-c p" . organize-imports-and-format)))

(provide 'init-lsp-mode)