|
|
@ -1,16 +1,24 @@
|
|
|
|
(use-package treesit
|
|
|
|
(use-package treesit
|
|
|
|
:if (ignore-errors (treesit-available-p))
|
|
|
|
:if (ignore-errors (treesit-available-p))
|
|
|
|
:mode
|
|
|
|
:config
|
|
|
|
((rx (literal ".") "rs" eos) . rust-ts-mode)
|
|
|
|
(let ((setup-treesit-mode (lambda (parser treesit-mode modes &optional interpreters)
|
|
|
|
((rx (literal ".") "py" eos) . python-ts-mode)
|
|
|
|
(if (not (treesit-language-available-p parser))
|
|
|
|
((rx (literal ".") "sh" eos) . bash-ts-mode)
|
|
|
|
(error "treesit language parser not available for %s" (symbol-name language))
|
|
|
|
:interpreter
|
|
|
|
(seq-each (lambda (mode)
|
|
|
|
("python" . python-ts-mode)
|
|
|
|
(add-to-list 'auto-mode-alist
|
|
|
|
("python3" . python-ts-mode)
|
|
|
|
(cons (rx (literal ".")
|
|
|
|
("bash" . bash-ts-mode)
|
|
|
|
(literal mode) eos)
|
|
|
|
("sh" . bash-ts-mode)
|
|
|
|
treesit-mode)))
|
|
|
|
("openrc-run" . bash-ts-mode))
|
|
|
|
modes)
|
|
|
|
|
|
|
|
(seq-each (lambda (interpreter)
|
|
|
|
|
|
|
|
(add-to-list 'interpreter-mode-alist
|
|
|
|
|
|
|
|
(cons interpreter treesit-mode)))
|
|
|
|
|
|
|
|
interpreters)))))
|
|
|
|
|
|
|
|
(funcall setup-treesit-mode 'python 'python-ts-mode '("py") '("python" "python3"))
|
|
|
|
|
|
|
|
(funcall setup-treesit-mode 'bash 'bash-ts-mode '("sh") '("bash" "sh" "openrc-run"))
|
|
|
|
|
|
|
|
(funcall setup-treesit-mode 'rust 'rust-ts-mode '("rs"))
|
|
|
|
|
|
|
|
(funcall setup-treesit-mode 'cpp 'c++-ts-mode '("cpp" "cxx" "c++" "hpp" "hxx" "h++"))))
|
|
|
|
|
|
|
|
|
|
|
|
(use-package rust-ts-mode
|
|
|
|
(use-package rust-ts-mode
|
|
|
|
:requires treesit
|
|
|
|
:requires treesit
|
|
|
|
:hook
|
|
|
|
:hook
|
|
|
|