Add tree-sitter

Amolith created

Change summary

dot_config/nvim/init.vim | 42 +++++++++++++++++++++++++++++++++++++-----
dot_doom.d/config.org    |  6 ++++++
dot_doom.d/packages.el   |  2 ++
3 files changed, 45 insertions(+), 5 deletions(-)

Detailed changes

dot_config/nvim/init.vim 🔗

@@ -23,13 +23,45 @@ Plug 'vim-syntastic/syntastic'			" syntax checking for various languages
 Plug 'godlygeek/tabular'                " required for aligning tables with next plugin
 Plug 'wakatime/vim-wakatime'            " Aggregate editor stats and metrics
 Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
+Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
 call plug#end()
 
-let g:rose_pine_variant = 'rose-pine-moon'
-
-" Set theme colours
-"set background=dark
-"colorscheme wilmersdorf
+lua <<EOF
+require'nvim-treesitter.configs'.setup {
+  highlight = {
+    enable = true,
+    custom_captures = {
+      -- Highlight the @foo.bar capture group with the "Identifier" highlight group.
+      ["foo.bar"] = "Identifier",
+    },
+    -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
+    -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
+    -- Using this option may slow down your editor, and you may see some duplicate highlights.
+    -- Instead of true it can also be a list of languages
+    additional_vim_regex_highlighting = false,
+  },
+}
+EOF
+lua <<EOF
+require'nvim-treesitter.configs'.setup {
+  incremental_selection = {
+    enable = true,
+    keymaps = {
+      init_selection = "gnn",
+      node_incremental = "grn",
+      scope_incremental = "grc",
+      node_decremental = "grm",
+    },
+  },
+}
+EOF
+lua <<EOF
+require'nvim-treesitter.configs'.setup {
+  indent = {
+    enable = true
+  }
+}
+EOF
 
 " LaTeX config
 let g:livepreview_previewer = 'zathura'

dot_doom.d/config.org 🔗

@@ -262,6 +262,12 @@ Look for various executables
 (add-hook 'sclang-mode-hook 'sclang-extensions-mode)
 #+END_SRC
 
+** Tree-sitter
+#+BEGIN_SRC emacs-lisp
+(global-tree-sitter-mode)
+(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
+#+END_SRC
+
 ** Editor metrics
 [[https://github.com/wakatime/wakatime-mode][wakatime-mode]] connected to self-hosted [[https://wakapi.dev/][Wakapi]] instance to get interesting stats
 about the time I spend in an editor

dot_doom.d/packages.el 🔗

@@ -18,6 +18,8 @@
 (package! auto-virtualenv)
 (package! wakatime-mode)
 (package! sclang-extensions)
+(package! tree-sitter)
+(package! tree-sitter-langs)
 
 ;; To install a package directly from a remote git repo, you must specify a
 ;; `:recipe'. You'll find documentation on what `:recipe' accepts here: