This commit is contained in:
iofq 2024-08-10 01:45:39 -05:00
parent b33413dd18
commit 9082d546f6
19 changed files with 362 additions and 291 deletions

View file

@ -3,61 +3,62 @@ if vim.g.did_load_treesitter_plugin then
end
vim.g.did_load_treesitter_plugin = true
require("nvim-treesitter.configs").setup {
ensure_installed = {},
highlight = {
require('nvim-treesitter.configs').setup {
ensure_installed = {},
highlight = {
enable = true,
disable = function(_, buf)
local max_filesize = 100 * 1024 -- 100 KiB
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,
},
indent = {
enable = true,
},
textobjects = {
select = {
enable = true,
disable = function(_, buf)
local max_filesize = 100 * 1024 -- 100 KiB
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,
lookahead = true,
keymaps = {
['af'] = '@function.outer',
['if'] = '@function.inner',
['aa'] = '@statement.outer',
['ia'] = '@parameter.inner',
},
},
indent = {
enable = true,
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']]'] = '@function.outer',
[']a'] = '@parameter.inner',
},
goto_previous_start = {
['[['] = '@function.outer',
['[a'] = '@parameter.inner',
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["aa"] = "@statement.outer",
["ia"] = "@parameter.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']]'] = '@function.outer',
[']a'] = '@parameter.inner',
},
goto_previous_start = {
['[['] = '@function.outer',
['[a'] = '@parameter.inner',
},
},
swap = {
enable = true,
swap_next = {
["s]"] = "@parameter.inner",
},
swap_previous = {
["s["] = "@parameter.inner",
},
}, },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<CR>',
node_incremental = '<TAB>',
node_decremental = '<S-TAB>',
},
swap = {
enable = true,
swap_next = {
['s]'] = '@parameter.inner',
},
swap_previous = {
['s['] = '@parameter.inner',
},
},
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<CR>',
node_incremental = '<TAB>',
node_decremental = '<S-TAB>',
},
},
}
require('treesitter-context').setup {