From 6c97f1359599c8329f51ba8051fdd3fc1ccc82ef Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 15 Jul 2023 01:08:26 -0700 Subject: [oni-core] Add settings for tree-sitter - Set the ‘treesit-extra-load-path’ to the value of ‘TREE_SITTER_GRAMMAR_PATH’. Emacs doesn't seem to do this automatically, but Guix sets that variable when grammars get installed. - Add ‘bash-ts-mode’ to the ‘interpreter-mode-alist’. In his article[1] about tree sitter support in Emacs Mickey Petersen mentions that it's best to use ‘major-mode-remap-alist’, however in his example he remaps ‘bash-mode’ to ‘bash-ts-mode’, but there is no ‘bash-mode’. Setting the ‘interpreter-mode-alist’ like this still works. [1]: https://www.masteringemacs.org/article/how-to-get-started-tree-sitter --- oni-core.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'oni-core.el') diff --git a/oni-core.el b/oni-core.el index bf58abf..cfd4e68 100644 --- a/oni-core.el +++ b/oni-core.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2023.0708.001128 +;; Version: 2023.0715.005059 ;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr mini-frame) ;; This program is free software; you can redistribute it and/or modify @@ -502,5 +502,11 @@ which normally have their errors suppressed." (with-eval-after-load 'isearch (setq isearch-lazy-count t)) +;;; Tree sitter + +(when (treesit-available-p) + (setq treesit-extra-load-path (string-split (getenv "TREE_SITTER_GRAMMAR_PATH") ";")) + (add-to-list 'interpreter-mode-alist '("bash" . bash-ts-mode))) + (provide 'oni-core) ;;; oni-core.el ends here -- cgit v1.2.3-54-g00ecf