From c2245455e52c04fdf2d5cd5ed9eba3430a1eb129 Mon Sep 17 00:00:00 2001 From: Lee Tang Date: Thu, 2 Mar 2023 10:57:18 +0800 Subject: [PATCH] update Signed-off-by: Lee Tang --- nvim/lua/config/nvim_treesitter.lua | 50 +++++++++++++++++++++++++++-- nvim/lua/plugins.lua | 10 ++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/nvim/lua/config/nvim_treesitter.lua b/nvim/lua/config/nvim_treesitter.lua index f7a2b92..b19591f 100644 --- a/nvim/lua/config/nvim_treesitter.lua +++ b/nvim/lua/config/nvim_treesitter.lua @@ -1,4 +1,50 @@ --- treesitter +local ncmd = vim.api.nvim_command + require('nvim-treesitter.configs').setup({ - ensure_installed = { 'rust', 'go', 'python', 'lua', 'c' }, -- one of "all", "maintained" (parsers with maintainers), or a list of languages + ensure_installed = { 'c', 'lua', 'rust', 'go', 'python', 'zig', 'markdown', 'solidity', 'jsonnet', 'vim' }, + highlight = { + enable = true, + }, + playground = { + enable = true, + }, + query_linter = { + enable = true, + use_virtual_text = true, + lint_events = { 'BufWrite', 'CursorHold' }, + }, + -- nvim-treesitter/nvim-treesitter-refactor + refactor = { + highlight_definitions = { enable = true }, + smart_rename = { + enable = true, + keymaps = { + smart_rename = 'gnr', + }, + }, + }, + indent = { enable = false }, + autopairs = { enable = true }, + rainbow = { enable = true }, + autotag = { enable = true }, + context_commentstring = { enable = true }, + -- RRethy/nvim-treesitter-endwise + endwise = { + enable = true, + }, + -- andymass/vim-matchup + matchup = { + enable = true, + }, + -- nvim-treesitter/nvim-treesitter-textobjects + textobjects = { + select = { + enable = true, + lookahead = true, + }, + }, + -- yioneko/nvim-yati + yati = { enable = true }, }) +ncmd('set foldmethod=expr') +ncmd('set foldexpr=nvim_treesitter#foldexpr()') diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index ff7ae8c..74c9eec 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -145,6 +145,16 @@ return require('packer').startup(function(use) config = function() require('config.nvim_treesitter') end, + requires = { + 'nvim-treesitter/playground', + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/nvim-treesitter-context', + 'RRethy/nvim-treesitter-endwise', + 'andymass/vim-matchup', -- extend % key + 'yioneko/nvim-yati', + 'm-demare/hlargs.nvim', + }, }) use({ 'iamcco/markdown-preview.nvim',