Associate flake.lock with json-mode/js-mode

This commit is contained in:
Henrik Lissner 2021-01-27 03:35:47 -05:00
parent 4d7640b4c2
commit 589e5a37af

View file

@ -10,6 +10,14 @@
(use-package! nix-mode
:interpreter ("\\(?:cached-\\)?nix-shell" . +nix-shell-init-mode)
:mode "\\.nix\\'"
:init
;; Treat flake.lock files as json. Fall back to js-mode because it's faster
;; than js2-mode, and its extra features aren't needed there.
(add-to-list 'auto-mode-alist
(cons "/flake\\.lock\\'"
(if (featurep! :lang json)
'json-mode
'js-mode)))
:config
(set-repl-handler! 'nix-mode #'+nix/open-repl)
(set-company-backend! 'nix-mode 'company-nixos-options)