80 lines
1.8 KiB
Lua
Executable File
80 lines
1.8 KiB
Lua
Executable File
return {
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
build = ":TSUpdate",
|
|
config = function()
|
|
local configs = require("nvim-treesitter.configs")
|
|
configs.setup({
|
|
ensure_installed = {
|
|
"go",
|
|
"gomod",
|
|
"gowork",
|
|
"gosum",
|
|
"lua",
|
|
"vim",
|
|
"vimdoc",
|
|
"query",
|
|
"markdown",
|
|
"markdown_inline",
|
|
"dart",
|
|
"python",
|
|
},
|
|
auto_install = true,
|
|
highlight = {
|
|
enable = true,
|
|
disable = function(lang, buf)
|
|
local max_filesize = 200 * 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,
|
|
},
|
|
indent = { enable = true, disable = { "ruby" } },
|
|
incremental_selection = {
|
|
enable = true,
|
|
keymaps = {
|
|
init_selection = "<enter>",
|
|
node_incremental = "<enter>",
|
|
scope_incremental = false,
|
|
node_decremental = "<bs>",
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
dependencies = {
|
|
"nvim-treesitter/nvim-treesitter",
|
|
},
|
|
init = function()
|
|
local config = require("nvim-treesitter.configs")
|
|
config.setup({
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
-- Automatically jump forward to textobj, similar to targets.vim
|
|
lookahead = true,
|
|
selection_modes = {
|
|
["@parameter.outer"] = "v", -- charwise
|
|
["@function.outer"] = "V", -- linewise
|
|
["@class.outer"] = "<c-v>", -- blockwise
|
|
},
|
|
include_surrounding_whitespace = true,
|
|
},
|
|
swap = {
|
|
enable = true,
|
|
swap_next = {
|
|
["<leader>csa"] = { query = "@parameter.inner", desc = "Swap with next parameter" },
|
|
},
|
|
swap_previous = {
|
|
["<leader>csA"] = "@parameter.inner",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
}
|