Move elisp into a folder and switch to emacs-wayland on linux.
This commit is contained in:
26
ansible/roles/emacs/files/elisp/lang-yaml.el
Normal file
26
ansible/roles/emacs/files/elisp/lang-yaml.el
Normal file
@@ -0,0 +1,26 @@
|
||||
(defun yaml-format-buffer ()
|
||||
"Run prettier."
|
||||
(interactive)
|
||||
(run-command-on-buffer "prettier" "--stdin-filepath" buffer-file-name)
|
||||
)
|
||||
|
||||
(use-package yaml-ts-mode
|
||||
:mode
|
||||
(
|
||||
("\\.y[a]?ml\\'" . yaml-ts-mode)
|
||||
("playbook\\.tmp\\'" . yaml-ts-mode)
|
||||
("environments/[^/]*/group_vars/[^/]*\\'" . yaml-ts-mode)
|
||||
("environments/[^/]*/host_vars/[^/]*\\'" . yaml-ts-mode)
|
||||
)
|
||||
:hook (
|
||||
(yaml-ts-mode . (lambda ()
|
||||
(add-hook 'before-save-hook 'yaml-format-buffer nil 'local)
|
||||
))
|
||||
)
|
||||
:init
|
||||
(add-to-list 'major-mode-remap-alist '(yaml-mode . yaml-ts-mode))
|
||||
(add-to-list 'treesit-language-source-alist '(yaml "https://github.com/ikatyang/tree-sitter-yaml"))
|
||||
(unless (treesit-ready-p 'yaml) (treesit-install-language-grammar 'yaml))
|
||||
)
|
||||
|
||||
(provide 'lang-yaml)
|
||||
Reference in New Issue
Block a user