irongit

My nvim configuration

59 lines1.4 KBLua
1---@type LazySpec[]
2return {
3 {
4 "nvim-mini/mini.ai",
5 event = "VeryLazy",
6 config = function()
7 require("mini.ai").setup({
8 custom_textobjects = {
9 -- Select between : and ,
10 x = function(ai_type)
11 local from = vim.fn.searchpos(":", "bnW")
12 local to = vim.fn.searchpos(",", "nW")
13
14 if from[1] == 0 or to[1] == 0 then
15 return
16 end
17
18 if ai_type == "i" then
19 -- inside: skip to next word after :
20 vim.fn.cursor(from[1], from[2])
21 vim.cmd("normal! w") -- move to next word
22 local word_start = vim.fn.getcurpos()
23
24 return {
25 from = { line = word_start[2], col = word_start[3] },
26 to = { line = to[1], col = to[2] - 1 },
27 }
28 else
29 -- around: include : and ,
30 return {
31 from = { line = from[1], col = from[2] },
32 to = { line = to[1], col = to[2] },
33 }
34 end
35 end,
36 },
37 })
38 end,
39 },
40 {
41 "nvim-mini/mini.pairs",
42 enabled = false,
43 },
44 {
45 "nvim-mini/mini.surround",
46 event = "VeryLazy",
47 opts = {
48 mappings = {
49 add = "qs",
50 delete = "ds",
51 replace = "cs",
52 find = "",
53 find_left = "",
54 highlight = "",
55 update_n_lines = "",
56 },
57 },
58 },
59}