feat(emacs): nix-ts-mode
This commit is contained in:
@@ -24,6 +24,12 @@
|
||||
(push '(?Q . ("''" . "''"))
|
||||
evil-surround-pairs-alist)))))
|
||||
|
||||
(use-package nix-ts-mode)
|
||||
(use-package nix-ts-mode
|
||||
:config
|
||||
;; (add-to-list 'major-mode-remap-alist `(nix-mode . nix-ts-mode))
|
||||
(syd-remap-mode-to-ts 'nix-mode))
|
||||
|
||||
(with-eval-after-load 'project
|
||||
(add-to-list 'project-vc-extra-root-markers "flake.nix"))
|
||||
|
||||
(provide 'syd/nix)
|
||||
|
||||
@@ -182,4 +182,15 @@ form."
|
||||
;; (user-error (concat "Ignoring a call to `lsp-install-server'"
|
||||
;; " — tell the caller to use Nix!")))
|
||||
|
||||
(defun syd-remap-mode-to-ts (mode)
|
||||
"Given a symbol MODE of form *-mode, remap *-mode to *-ts-mode via
|
||||
`major-mode-remap-alist'."
|
||||
(let ((s (symbol-name mode)))
|
||||
(if (string-match (rx bol (group (* any)) "-mode" eol)
|
||||
s)
|
||||
(add-to-list
|
||||
'major-mode-remap-alist
|
||||
(cons mode (intern (concat (match-string 1 s) "-ts-mode"))))
|
||||
(error "Symbol `%c' is not a mode." mode))))
|
||||
|
||||
(provide 'syd/prelude)
|
||||
|
||||
Reference in New Issue
Block a user