feat(lvim): add nvim-treesitter-textobjects

chezmoi
sgoudham 2 years ago
parent ec328f2d45
commit ffeed324db
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -4,6 +4,7 @@ lvim.plugins = {
{ "gpanders/editorconfig.nvim" }, { "gpanders/editorconfig.nvim" },
{ "p00f/nvim-ts-rainbow" }, { "p00f/nvim-ts-rainbow" },
{ "nvim-treesitter/playground" }, { "nvim-treesitter/playground" },
{ "nvim-treesitter/nvim-treesitter-textobjects"},
{ "simrat39/rust-tools.nvim" }, { "simrat39/rust-tools.nvim" },
{ {
"saecki/crates.nvim", "saecki/crates.nvim",

@ -1,3 +1,47 @@
lvim.builtin.treesitter.rainbow.enable = true lvim.builtin.treesitter.rainbow.enable = true
lvim.builtin.treesitter.highlight.enable = true lvim.builtin.treesitter.highlight.enable = true
lvim.builtin.treesitter.ensure_installed = "all" lvim.builtin.treesitter.ensure_installed = "all"
lvim.builtin.treesitter.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",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
}

Loading…
Cancel
Save