feat: emacs - format nix files via alejandra

This commit is contained in:
Ryan Yin
2024-01-04 13:45:24 +08:00
parent a9c2031aee
commit 76883edf0b
2 changed files with 10 additions and 1 deletions
+2 -1
View File
@@ -74,7 +74,7 @@ in {
} }
(mkIf pkgs.stdenv.isLinux ( (mkIf pkgs.stdenv.isLinux (
# Do not use emacs-nox here, which makes the mouse wheel work abnormally # Do not use emacs-nox here, which makes the mouse wheel work abnormally in terminal mode.
let emacsPkg = pkgs.emacs29; in let emacsPkg = pkgs.emacs29; in
{ {
home.packages = [emacsPkg]; home.packages = [emacsPkg];
@@ -86,6 +86,7 @@ in {
})) }))
(mkIf pkgs.stdenv.isDarwin ( (mkIf pkgs.stdenv.isDarwin (
# Do not use emacs-nox here, which makes the mouse wheel work abnormally in terminal mode.
let emacsPkg = pkgs.emacs29; in let emacsPkg = pkgs.emacs29; in
{ {
home.packages = [emacsPkg]; home.packages = [emacsPkg];
@@ -123,6 +123,14 @@
(after! markdown-mode (after! markdown-mode
(global-font-lock-mode 0)) (global-font-lock-mode 0))
;; use alejandra to format nix files
(use-package lsp-nix
:ensure lsp-mode
:after (lsp-mode)
:demand t
:custom
(lsp-nix-nil-formatter ["alejandra"]))
;; fix yaml highlighting for catppuccin theme ;; fix yaml highlighting for catppuccin theme
;; https://github.com/catppuccin/emacs/issues/55 ;; https://github.com/catppuccin/emacs/issues/55
(add-hook 'yaml-mode-hook (add-hook 'yaml-mode-hook