2021-02-21 03:01:34 +00:00
|
|
|
;; -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;; YAML - literally the worst but still holds an important place in my life
|
2024-05-04 01:39:54 +00:00
|
|
|
(use-package yaml-ts-mode
|
2021-02-21 03:01:34 +00:00
|
|
|
:mode ("\\.yaml\\'" "\\.yml\\'")
|
|
|
|
:config
|
2024-05-04 01:39:54 +00:00
|
|
|
(add-hook 'yaml-ts-mode-hook #'highlight-indent-guides-mode))
|
|
|
|
|
|
|
|
(use-package yaml-pro
|
|
|
|
:when (treesit-ready-p 'yaml)
|
2024-05-06 15:04:58 +00:00
|
|
|
:hook (yaml-ts-mode . yaml-pro-ts-mode)
|
2024-07-24 14:26:33 +00:00
|
|
|
:config
|
|
|
|
(defun yaml-pro-edit-initialize-buffer-filter-args-advice (args)
|
|
|
|
(if-let ((mode (language-detection-detect-mode (buffer-string))))
|
|
|
|
(cl-destructuring-bind (parent-buffer buffer initial-text type initialize path) args
|
|
|
|
(let ((init-func (lambda ()
|
|
|
|
(funcall mode)
|
|
|
|
(when initialize
|
|
|
|
(call-interactively initialize)))))
|
|
|
|
(list parent-buffer buffer initial-text type init-func path)))
|
|
|
|
args))
|
|
|
|
(advice-add 'yaml-pro-edit-initialize-buffer :filter-args #'yaml-pro-edit-initialize-buffer-filter-args-advice)
|
2024-05-06 15:04:58 +00:00
|
|
|
:general
|
|
|
|
(yaml-pro-ts-mode-map [remap evil-backward-section-begin] #'yaml-pro-ts-prev-subtree
|
|
|
|
[remap evil-forward-section-begin] #'yaml-pro-ts-next-subtree
|
|
|
|
[remap evil-shift-right] #'yaml-pro-ts-indent-subtree
|
|
|
|
[remap evil-shift-left] #'yaml-pro-ts-unindent-subtree
|
|
|
|
"C-c j" #'yaml-pro-ts-move-subtree-down
|
|
|
|
"C-c k" #'yaml-pro-ts-move-subtree-up
|
|
|
|
"C-c f" #'yaml-pro-format))
|
2021-02-21 03:01:34 +00:00
|
|
|
|
|
|
|
(provide 'init-yaml)
|