Created
June 24, 2019 19:21
-
-
Save seanhagen/8421498ea363a2143afd5e73006266b0 to your computer and use it in GitHub Desktop.
Emacs LSP & yasnippet config
This file contains hidden or 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
;;; go-config.el --- Summary | |
;;; Commentary: | |
;;; Code: | |
(setenv "GOPATH" "/home/sean/Code/Go") | |
(use-package go-mode | |
:ensure t | |
:defer t | |
:mode "\\.go\\'" | |
:bind (:map go-mode-map | |
("C-c i" . go-goto-imports) | |
("C-c C-r" . go-remove-unused-imports) | |
("C-c C-t" . go-test-current-file) | |
("M-." . godef-jump)) | |
:config | |
(add-hook 'before-save-hook 'gofmt-before-save) | |
(go-eldoc-setup) | |
(use-package dap-go) | |
(use-package godoc | |
:bind (:map go-mode-map ("C-c C-k" . godoc-at-point))) | |
(use-package go-add-tags | |
:ensure t | |
:bind (:map go-mode-map ("C-c '" . go-add-tags)) | |
:commands go-add-tags) | |
(use-package go-eldoc | |
:ensure t | |
:init | |
(add-hook 'go-mode-hook 'go-eldoc-setup)) | |
(use-package helm-go-package | |
:ensure t | |
:config | |
(substitute-key-definition 'go-import-add 'helm-go-package go-mode-map)) | |
(use-package go-playground | |
:ensure t) | |
(use-package go-direx | |
:ensure t | |
:bind (:map go-mode-map | |
("C-c C-j" . go-direx-pop-to-buffer)))) | |
(provide 'go-config) | |
;;; go-config.el ends here |
This file contains hidden or 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
;;; lsp-config.el --- Summary | |
;;; Commentary: | |
;;; Code: | |
(message "Loading lsp config") | |
(use-package lsp-mode | |
:ensure t | |
:commands lsp | |
:defer t | |
:hook (go-mode . lsp) | |
:config | |
(setq lsp-eldoc-enable-hover t | |
lsp-eldoc-enable-signature-help t | |
lsp-eldoc-prefer-signature-help t | |
lsp-response-timeout 5) | |
:init | |
(unless (executable-find "/home/sean/Code/Go/bin/gopls") | |
(user-error "Go LSP server is not on PATH\n")) | |
(add-hook 'prog-mode-hook #'lsp) | |
(setq lsp-prefer-flymake :none)) | |
(use-package lsp-ui | |
:ensure t | |
:defer t | |
:commands lsp-ui-mode | |
:config | |
(setq lsp-ui-doc-enable nil | |
lsp-ui-doc-max-width 70 | |
lsp-ui-peek-enable t | |
lsp-ui-peek-always-show nil | |
lsp-ui-sideline-enable nil)) | |
(use-package company-lsp | |
:ensure t | |
:defer t | |
:commands company-lsp | |
:config | |
(push 'company-lsp company-backends)) | |
(provide 'lsp-config) | |
;;; lsp-config.el ends here |
This file contains hidden or 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
;;; yasnippet-config -- Summary | |
;;; Commentary: | |
;;; Code: | |
(message "Loading yasnippet config") | |
(use-package yasnippet | |
:ensure t | |
:diminish yas-minor-mode | |
:bind (:map yas-minor-mode-map | |
("C-c C-e" . yas-expand)) | |
:config | |
(yas-reload-all) | |
(add-hook 'prog-mode-hook #'yas-minor-mode) | |
;;(yas-global-mode 1) | |
(setq yas-prompt-functions '(yas-dropdown-prompt | |
yas-ido-prompt | |
yas-completing-prompt))) | |
(provide 'yasnippet-config) | |
;;; yasnippet-config.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment