From f0c7bc619ab9d6f839de55dac31165ec85e0f4ad Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Thu, 9 Mar 2023 11:36:23 -0500 Subject: [PATCH] damn treesitter --- home/config/nvim/init.lua | 35 +++++++++++++------------------- home/config/nvim/lua/plugins.lua | 3 +++ hosts/_common/programs.nix | 13 +++++++----- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/home/config/nvim/init.lua b/home/config/nvim/init.lua index df7bacf..d620da4 100644 --- a/home/config/nvim/init.lua +++ b/home/config/nvim/init.lua @@ -125,28 +125,21 @@ return require('packer').startup(function(use) }, }) + require("nvim-treesitter.configs").setup({ + highlight = { enable = false, disable = { "lua" } }, + indent = { enable = true }, + refactor = { highlight_definitions = { enable = true } }, + incremental_selection = { enable = true }, + matchup = { enable = true }, + textsubjects = { + enable = true, + prev_selection = ",", + keymaps = { + ["."] = "textsubjects-smart", + }, + }, + }) - require('nvim-treesitter.configs').setup { - ensure_installed = { - "bash", "c", "c_sharp", "cmake", "cpp", "css", "diff", "dockerfile", "fish", "git_rebase", - "gitattributes", "gitcommit", "gitignore", "go", "gomod", "html", "htmldjango", "http", "ini", - "java", "javascript", "jq", "jsdoc", "json", "json5", "jsonc", "llvm", "lua", "m68k", "make", - "markdown", "markdown_inline", "nix", "python", "rst", "ruby", "rust", "scss", "sql", "terraform", - "toml", "tsx", "typescript", "vim", "vue", "yaml" - }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting=false, - }, - ident = { enable = true }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = nil, - } - } - -- KEYS -- Vimspector diff --git a/home/config/nvim/lua/plugins.lua b/home/config/nvim/lua/plugins.lua index f1ae7a5..d20149a 100644 --- a/home/config/nvim/lua/plugins.lua +++ b/home/config/nvim/lua/plugins.lua @@ -68,5 +68,8 @@ return function(use) use({'puremourning/vimspector'}) + use({'nvim-treesitter/nvim-treesitter-refactor'}) + use({'RRethy/nvim-treesitter-textsubjects'}) + end diff --git a/hosts/_common/programs.nix b/hosts/_common/programs.nix index 8f39f90..862d86b 100644 --- a/hosts/_common/programs.nix +++ b/hosts/_common/programs.nix @@ -27,13 +27,16 @@ # # Inject tree-sitters, since they're annoying to maintain with sideloading # (nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)) #]; + plugins = [ + pkgs.vimPlugins.nvim-treesitter.withAllGrammars + ]; # We used to manage our own init.lua but now we want the home-manager # managed init.vim to load our init.lua which makes this a little dirty. - # extraConfig = '' - # lua << EOF - # ${builtins.readFile ../../home/config/nvim/init.lua} - # EOF - # ''; + extraConfig = '' + lua << EOF + ${builtins.readFile ../../home/config/nvim/init.lua} + EOF + ''; }; programs.fish = {