pinwheel: Add go-mode and hook it up with eglot

This commit is contained in:
Alexander Heldt
2023-09-09 10:12:08 +02:00
parent eca41927c5
commit 9a8a2ca450
4 changed files with 40 additions and 1 deletions

View File

@@ -25,6 +25,7 @@
./modules/syncthing ./modules/syncthing
./modules/firefox ./modules/firefox
./modules/calibre ./modules/calibre
./modules/go
]; ];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];

View File

@@ -385,3 +385,31 @@ https://github.com/justbur/emacs-which-key
(setq diff-hl-side 'right) (setq diff-hl-side 'right)
(global-diff-hl-mode t)) (global-diff-hl-mode t))
#+END_SRC #+END_SRC
* LSP
** Eglot
#+BEGIN_SRC emacs-lisp
(defun alex/eglot-organize-imports () (interactive)
(call-interactively 'eglot-code-action-organize-imports))
(defun alex/eglot-on-save ()
(add-hook 'before-save-hook #'eglot-format-buffer -10 t)
(add-hook 'before-save-hook #'alex/eglot-organize-imports nil t)
)
(use-package eglot
:hook (
(eglot-managed-mode . alex/eglot-on-save)
(go-mode . eglot-ensure)
(nix-mode . eglot-ensure)
)
)
#+END_SRC
** Go
#+BEGIN_SRC emacs-lisp
(use-package go-mode
:hook (
(go-mode . eglot-ensure)
)
)
#+END_SRC

View File

@@ -17,4 +17,6 @@ in
pkgs.wl-clipboard pkgs.wl-clipboard
]; ];
}; };
environment.systemPackages = [ pkgs.ripgrep ];
} }

View File

@@ -0,0 +1,8 @@
{ home-manager, pkgs, ... }:
{
home-manager.users.alex = {
home.packages = [ pkgs.gopls ];
};
environment.systemPackages = [ pkgs.go ];
}