90 lines
3.1 KiB
Lua
90 lines
3.1 KiB
Lua
return {
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
enable = true,
|
|
build = ":TSUpdate",
|
|
disable = function(lang, buf)
|
|
local max_filesize = 100 * 1024 -- 100 KB
|
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
if ok and stats and stats.size > max_filesize then
|
|
return true
|
|
end
|
|
end,
|
|
dependencies = {
|
|
"treesitter-context",
|
|
},
|
|
opts = {
|
|
matchup = { enable = true },
|
|
highlight = {
|
|
enable = true,
|
|
additional_vim_regex_highlighting = false,
|
|
},
|
|
incremental_selection = { enable = true },
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
keymaps = {
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
['aa'] = '@parameter.outer',
|
|
['ia'] = '@parameter.inner',
|
|
['af'] = '@function.outer',
|
|
['if'] = '@function.inner',
|
|
['ac'] = '@class.outer',
|
|
['ic'] = '@class.inner',
|
|
['ii'] = '@conditional.inner',
|
|
['ai'] = '@conditional.outer',
|
|
['il'] = '@loop.inner',
|
|
['al'] = '@loop.outer',
|
|
['at'] = '@comment.outer',
|
|
},
|
|
},
|
|
move = {
|
|
enable = true,
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
goto_next_start = {
|
|
[']f'] = '@function.outer',
|
|
[']c'] = '@class.outer',
|
|
},
|
|
goto_next_end = {
|
|
[']F'] = '@function.outer',
|
|
[']C'] = '@class.outer',
|
|
},
|
|
goto_previous_start = {
|
|
['[f'] = '@function.outer',
|
|
['[c'] = '@class.outer',
|
|
},
|
|
goto_previous_end = {
|
|
['[F'] = '@function.outer',
|
|
['[C'] = '@class.outer',
|
|
},
|
|
},
|
|
},
|
|
indent = { enable = true },
|
|
ensure_installed = {
|
|
"c_sharp",
|
|
"lua",
|
|
"c",
|
|
"vim",
|
|
"javascript",
|
|
"regex",
|
|
"markdown_inline",
|
|
"typescript",
|
|
"html",
|
|
"jsonc",
|
|
"go",
|
|
},
|
|
auto_install = true,
|
|
},
|
|
config = function(_, opts)
|
|
require("nvim-treesitter.configs").setup(opts)
|
|
end,
|
|
},
|
|
{
|
|
"nvim-treesitter/nvim-treesitter-context",
|
|
name = "treesitter-context",
|
|
lazy = true,
|
|
opts = {},
|
|
},
|
|
}
|