Files
dotfiles/nvim.bak/lua/plugins/treesitter.lua
d0zingcat d4d819083c switch to lazyvim
Signed-off-by: d0zingcat <lee.w.tang@gmail.com>
2025-02-22 23:42:29 +08:00

72 lines
2.1 KiB
Lua

return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
event = 'VeryLazy',
dependencies = {
'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',
},
init = function()
local ncmd = vim.api.nvim_command
ncmd('set foldmethod=expr')
ncmd('set foldexpr=nvim_treesitter#foldexpr()')
end,
opts = {
ensure_installed = {
'c', 'lua', 'rust', 'go', 'python',
'zig', 'markdown', 'solidity', 'jsonnet', 'vim', 'graphql'
},
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 },
},
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
end,
}