From c88637df9f4b0a92ed048bf8dff507cb73118819 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 26 Jun 2022 14:13:15 -0700 Subject: feat(prog): enable tree-sitter tree-sitter is an incremental parsing system, and this change installs the binding for Emacs. It improves significantly the code highlighting system (as it does not rely on regex when the language is supported by tree-sitter) and improves performance in general. Change-Id: Ibc3d6c7133b323d6cc63ffb248cd83f71ac5c94a --- emacs/custom/my-prog.el | 9 +++++++++ emacs/init.el | 2 ++ 2 files changed, 11 insertions(+) (limited to 'emacs') diff --git a/emacs/custom/my-prog.el b/emacs/custom/my-prog.el index 65faad2..b1a0403 100644 --- a/emacs/custom/my-prog.el +++ b/emacs/custom/my-prog.el @@ -4,6 +4,15 @@ ;;; Code: +(require 'tree-sitter) +(require 'tree-sitter-langs) +;; enable tree-sitter mode for all supported major modes +(global-tree-sitter-mode) +;; the minor mode tree-sitter-hl-mode provides the framework for syntax +;; highlighting. It overrides the regex-based highlighting provided by +;; font-lock-mode, using the syntax tree provided by tree-sitter-mode +(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode) + (customize-set-variable 'Man-notify-method 'aggressive) (customize-set-variable 'Man-fontify-manpage-flag t) diff --git a/emacs/init.el b/emacs/init.el index 0582745..cb2fbfa 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -48,6 +48,8 @@ systemd terraform-doc terraform-mode + tree-sitter + tree-sitter-langs vertico which-key yaml-mode -- cgit 1.4.1