From ab2823910b07083de35ed31acc93ce55b2cc1cd2 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Tue, 19 Apr 2022 09:57:02 +0200 Subject: [PATCH] nvim: refactor treesitter config --- .config/nvim/lua/plugins.lua | 9 ++---- .../nvim/lua/{dln => plugins}/treesitter.lua | 29 ++----------------- 2 files changed, 6 insertions(+), 32 deletions(-) rename .config/nvim/lua/{dln => plugins}/treesitter.lua (56%) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index c3993be..c082394 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -153,19 +153,16 @@ return require('packer').startup(function() end } + -- treesitter use { "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", requires = { "nvim-treesitter/playground", "nvim-treesitter/nvim-treesitter-textobjects", "windwp/nvim-ts-autotag" }, - config = function() - require("dln.treesitter") - vim.wo.foldmethod = "expr" - vim.wo.foldexpr = "nvim_treesitter#foldexpr()" - end + run = ":TSUpdate", + config = function() require("plugins/treesitter") end, } use { diff --git a/.config/nvim/lua/dln/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua similarity index 56% rename from .config/nvim/lua/dln/treesitter.lua rename to .config/nvim/lua/plugins/treesitter.lua index 13ab949..60a6002 100644 --- a/.config/nvim/lua/dln/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,3 +1,6 @@ +vim.wo.foldmethod = "expr" +vim.wo.foldexpr = "nvim_treesitter#foldexpr()" + require("nvim-treesitter.configs").setup { ensure_installed = "all", highlight = { @@ -46,32 +49,6 @@ require("nvim-treesitter.configs").setup { ["[M"] = "@class.outer" } }, - -- select = { - -- enable = true, - -- keymaps = { - -- -- You can use the capture groups defined in textobjects.scm - -- ["af"] = "@function.outer", - -- ["if"] = "@function.inner", - -- ["ac"] = "@class.outer", - -- ["ic"] = "@class.inner", - -- -- Or you can define your own textobjects like this - -- ["iF"] = { - -- python = "(function_definition) @function", - -- cpp = "(function_definition) @function", - -- c = "(function_definition) @function", - -- java = "(method_declaration) @function" - -- } - -- } - -- }, - -- swap = { - -- enable = true, - -- swap_next = { - -- ["l"] = "@parameter.inner" - -- }, - -- swap_previous = { - -- ["h"] = "@parameter.inner" - -- } - -- } }, --- nvim-ts-autotag --- autotag = {