From 35f7b81ec7a8f0d8cce31ec953909a4796e5212c Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Mon, 26 Aug 2024 14:41:06 +0200 Subject: [PATCH] update treesitter config (add incr. selection, indent) --- home/base/programs/nixvim/default.nix | 38 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/home/base/programs/nixvim/default.nix b/home/base/programs/nixvim/default.nix index b45fb87..faf93c3 100644 --- a/home/base/programs/nixvim/default.nix +++ b/home/base/programs/nixvim/default.nix @@ -7,16 +7,17 @@ viAlias = true; vimAlias = true; - performance.byteCompileLua.enable = true; - - clipboard.providers.wl-copy.enable = true; - - globals.mapleader = " "; colorschemes.catppuccin = { enable = true; settings = { flavour = "frappe"; }; }; + performance.byteCompileLua.enable = true; + + clipboard.providers.wl-copy.enable = true; + + globals.mapleader = " "; + opts = { smartindent = false; relativenumber = true; @@ -71,7 +72,7 @@ { action = '' lua vim.lsp.buf.code_action({ apply = true }) - ''; + ''; key = "lc"; options = { desc = "Apply code actions"; @@ -80,7 +81,7 @@ { action = '' lua vim.lsp.buf.format() - ''; + ''; key = "lf"; options = { desc = "Format buffer"; @@ -157,8 +158,27 @@ treesitter = { enable = true; settings = { - highlight.enable = true; - indent.enable = true; + auto_install = true; + highlight = { + additional_vim_regex_highlighting = true; + custom_captures = { }; + enable = true; + }; + incremental_selection = { + enable = true; + keymaps = { + init_selection = false; + node_decremental = "grm"; + node_incremental = "grn"; + scope_incremental = "grc"; + }; + }; + indent = { + enable = true; + }; + parser_install_dir = { + __raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'treesitter')"; + }; }; }; treesitter-context.enable = true;