mini.ai vs. treesitter-textobjects for treesitter keymaps #243
-
First of all, thanks for your contributions to the Neovim community and your high-quality plugins! I was wondering whether there would be any benefit of me changing my current setup for require("nvim-treesitter.configs").setup {
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["ia"] = "@parameter.inner",
["ai"] = "@conditional.outer",
["ii"] = "@conditional.inner",
},
},
}
} What's the difference between using this approach vs. require('mini.ai').setup({
custom_textobjects = {
... ? Are there any performance differences perhaps? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Probably no performance difference, but I didn't make a thorough check. Most differences come from slightly different features:
There are also slight non-obvious caveats in 'mini.ai' design:
|
Beta Was this translation helpful? Give feedback.
Probably no performance difference, but I didn't make a thorough check.
Most differences come from slightly different features:
lookahead = true
. See this help section about search methods.an
/in
/al
/il
). Basically, they select textobject with temporarily changed search method (next
andprev
respectively). Initially they were not part of 'mini.ai', but I've gotten several people describing their benefits and boy was I wrong. They are really useful especially with combination with dot-repeat. Like you can usecin'
to edit inside next quotes while…