Function: yaml-ts-mode
yaml-ts-mode is an autoloaded, interactive and byte-compiled function
defined in yaml-ts-mode.el.gz.
Signature
(yaml-ts-mode)
Documentation
Major mode for editing YAML, powered by tree-sitter.
In addition to any hooks its parent mode text-mode might have run,
this mode runs the hook yaml-ts-mode-hook, as the final or
penultimate step during initialization.
Probably introduced at or before Emacs version 29.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/yaml-ts-mode.el.gz
;;;###autoload
(define-derived-mode yaml-ts-mode text-mode "YAML"
"Major mode for editing YAML, powered by tree-sitter."
:group 'yaml
:syntax-table yaml-ts-mode--syntax-table
(when (treesit-ready-p 'yaml)
(treesit-parser-create 'yaml)
;; Comments.
(setq-local comment-start "# ")
(setq-local comment-end "")
;; Indentation.
(setq-local indent-tabs-mode nil)
;; Font-lock.
(setq-local treesit-font-lock-settings yaml-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'((comment)
(string type)
(constant escape-sequence number property)
(bracket delimiter error misc-punctuation)))
(treesit-major-mode-setup)))