diff options
author | Franck Cuny <franck@fcuny.net> | 2022-09-17 14:03:20 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-09-17 14:03:20 -0700 |
commit | 9a57d255403c97f46306436b6e282b5da836ffe0 (patch) | |
tree | 0568f8ba44a66c7f45f88195d8e39051e749881d /emacs | |
parent | feat(lsp): configure lsp-mode for Emacs (diff) | |
download | emacs.d-9a57d255403c97f46306436b6e282b5da836ffe0.tar.gz |
feat(lang/go): configure Emacs for go
Change-Id: I2f33baa1ef2f75d770203da210065fed15f567e8
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/custom/my-lang-go.el | 30 | ||||
-rw-r--r-- | emacs/init.el | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/emacs/custom/my-lang-go.el b/emacs/custom/my-lang-go.el new file mode 100644 index 0000000..aa9f43b --- /dev/null +++ b/emacs/custom/my-lang-go.el @@ -0,0 +1,30 @@ +;;; my-lang-go.el --- configure emacs for go -*- lexical-binding: t -*- +;; Author: Franck Cuny <franck@fcuny.net> + +;;; Commentary: + +;;; Code: + +(require 'go-mode) +(require 'gotest) +(require 'lsp-mode) + +(add-hook 'go-mode-hook #'lsp-deferred) + +(defun my/lsp-go-install-save-hooks () + "Set up before-save hooks to format buffer and add/delete imports." + (add-hook 'before-save-hook #'lsp-format-buffer t t) + (add-hook 'before-save-hook #'lsp-organize-imports t t)) + +(defun my/go-mode-setup () + "Hooks for `go-mode'." + (setq tab-width 4) + (setq go-test-verbose t)) + +(add-hook 'go-mode-hook #'my/lsp-go-install-save-hooks) +(add-hook 'go-mode-hook #'my/go-mode-setup) +(add-hook 'go-mode-hook #'yas-minor-mode) + +(provide 'my-lang-go) + +;;; my-lang-go.el ends here diff --git a/emacs/init.el b/emacs/init.el index 2dcca81..7db5aab 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -51,6 +51,7 @@ (require 'my-elfeed) (require 'my-lsp) +(require 'my-lang-go) (require 'my-lang-python) (require 'my-buffers) |