mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-01-31 10:57:58 +00:00
54 lines
1.4 KiB
Lua
54 lines
1.4 KiB
Lua
-- tree-sitter integration with Neovim.
|
|
return {
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
dependencies = {
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
},
|
|
build = ":TSUpdate",
|
|
config = function()
|
|
vim.opt.foldmethod = "expr"
|
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
|
|
|
require("nvim-treesitter.configs").setup({
|
|
highlight = {
|
|
enable = true,
|
|
additional_vim_regex_highlighting = false,
|
|
},
|
|
|
|
incremental_selection = {
|
|
enable = true,
|
|
keymaps = {
|
|
init_selection = "gnn",
|
|
node_incremental = "grn",
|
|
scope_incremental = "grc",
|
|
node_decremental = "grm",
|
|
},
|
|
},
|
|
|
|
indent = { enable = true },
|
|
|
|
-- custom text objects with nvim-treesitter-textobjects
|
|
-- I've just copied this from the README but they are reasonable additions to me.
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
lookahead = true,
|
|
|
|
keymaps = {
|
|
["af"] = "@function.outer",
|
|
["if"] = "@function.inner",
|
|
["ae"] = "@block.outer",
|
|
["ie"] = "@block.inner",
|
|
["ac"] = "@class.outer",
|
|
["ic"] = "@class.inner",
|
|
["aC"] = "@conditional.outer",
|
|
["iC"] = "@conditional.inner",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
}
|