Skip to content

Commit

Permalink
feat: added mini.ai for better text objects
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 4, 2023
1 parent c7d302e commit 9907695
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lua/lazyvim/plugins/coding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,36 @@ return {
})
end,
},

-- better text-objects
{
"echasnovski/mini.ai",
keys = {
{ "a", mode = { "x", "o" } },
{ "i", mode = { "x", "o" } },
},
dependencies = {
{
"nvim-treesitter/nvim-treesitter-textobjects",
init = function()
-- no need to load the plugin, since we only need its queries
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
end,
},
},
config = function()
local ai = require("mini.ai")
ai.setup({
n_lines = 500,
custom_textobjects = {
o = ai.gen_spec.treesitter({
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
}, {}),
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
},
})
end,
},
}

0 comments on commit 9907695

Please sign in to comment.