From f8bb16902ae9ab5d39bc2658f897e9ef8eb26e15 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 18 Mar 2024 02:20:23 -0300 Subject: [PATCH] feat(nvim): use and configure treesitter from lua, not nix --- programs/neovim/default.nix | 43 ----------------- programs/neovim/user/plugins/treesitter.lua | 51 ++++++++++++++++++++- 2 files changed, 49 insertions(+), 45 deletions(-) diff --git a/programs/neovim/default.nix b/programs/neovim/default.nix index 97e4c53..dbc4f92 100644 --- a/programs/neovim/default.nix +++ b/programs/neovim/default.nix @@ -57,48 +57,5 @@ { "nvim/lua/resession/extensions".source = "${astronvim}/lua/resession/extensions"; } { "nvim/lua/lazy_snapshot.lua".source = "${astronvim}/lua/lazy_snapshot.lua"; } { "nvim/lua/user".source = ./user; } - { - "nvim/parser".source = - let - parsers = pkgs.symlinkJoin { - name = "treesitter-parsers"; - paths = (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with plugins; [ - bash - c - cmake - cpp - css - cuda - dockerfile - gdscript - glsl - godot_resource - html - javascript - jsdoc - json - jsonc - lua - lua - markdown - markdown_inline - nim - nim_format_string - nix - objc - proto - python - query - tsx - typescript - vim - vimdoc - vue - yaml - ])).dependencies; - }; - in - "${parsers}/parser"; - } ]; } diff --git a/programs/neovim/user/plugins/treesitter.lua b/programs/neovim/user/plugins/treesitter.lua index c717d37..ecc9a37 100644 --- a/programs/neovim/user/plugins/treesitter.lua +++ b/programs/neovim/user/plugins/treesitter.lua @@ -2,7 +2,54 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it - opts.ensure_installed = nil - opts.automatic_installation = false + local utils = require "astronvim.utils" + opts.incremental_selection = { + enable = true, + keymaps = { + init_selection = "", -- Ctrl + Space + node_incremental = "", + scope_incremental = "", -- Alt + Space + node_decremental = "", -- Backspace + }, + } + opts.ignore_install = { "gotmpl" } + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { + -- Programming + "c", + "cmake", + "cpp", + "css", + "gdscript", + "godot_resource", + "html", + "javascript", + "jsdoc", + "lua", + "nim", + "nim_format_string", + "objc", + "proto", + "python", + "tsx", + "typescript", + "vue", + -- Scripting + "bash", + "glsl", + -- Configuring + "dockerfile", + "json", + "jsonc", + "nix", + "yaml", + -- Misc + "cuda", + "markdown", + "markdown_inline", + "query", + -- VIM + "vim", + "vimdoc", + }) end, }