summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/plugins')
-rw-r--r--.config/nvim/lua/plugins/mini-ai.lua27
-rw-r--r--.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua53
-rw-r--r--.config/nvim/lua/plugins/snacks.lua1
3 files changed, 28 insertions, 53 deletions
diff --git a/.config/nvim/lua/plugins/mini-ai.lua b/.config/nvim/lua/plugins/mini-ai.lua
new file mode 100644
index 0000000..3e625fd
--- /dev/null
+++ b/.config/nvim/lua/plugins/mini-ai.lua
@@ -0,0 +1,27 @@
+return {
+ 'echasnovski/mini.ai',
+ event = 'VeryLazy',
+ opts = function()
+ local ai = require('mini.ai')
+ return {
+ n_lines = 500,
+ custom_textobjects = {
+ o = ai.gen_spec.treesitter({ -- code block
+ 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' }), -- function
+ c = ai.gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }), -- class
+ t = { '<([%p%w]-)%f[^<%w][^<>]->.-</%1>', '^<.->().*()</[^/]->$' }, -- tags
+ d = { '%f[%d]%d+' }, -- digits
+ e = { -- Word with case
+ { '%u[%l%d]+%f[^%l%d]', '%f[%S][%l%d]+%f[^%l%d]', '%f[%P][%l%d]+%f[^%l%d]', '^[%l%d]+%f[^%l%d]' },
+ '^().*()$',
+ },
+ -- g = LazyVim.mini.ai_buffer, -- buffer
+ u = ai.gen_spec.function_call(), -- u for "Usage"
+ U = ai.gen_spec.function_call({ name_pattern = '[%w_]' }), -- without dot in function name
+ },
+ }
+ end,
+}
diff --git a/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua b/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua
deleted file mode 100644
index d30b93c..0000000
--- a/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua
+++ /dev/null
@@ -1,53 +0,0 @@
-return {
- 'nvim-treesitter/nvim-treesitter-textobjects',
- event = 'VeryLazy',
- dependencies = { 'nvim-treesitter/nvim-treesitter' },
- config = function()
- ---@diagnostic disable-next-line: missing-fields
- require('nvim-treesitter.configs').setup({
- 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
- ['af'] = { query = '@function.outer', desc = 'Select entire function' },
- ['if'] = { query = '@function.inner', desc = 'Select function body' },
- ['ac'] = { query = '@class.outer', desc = 'Select entire class' },
- ['ic'] = { query = '@class.inner', desc = 'Select class body' },
- ['as'] = { query = '@scope.outer', query_group = 'locals', desc = 'Select language scope' },
- ['is'] = { query = '@scope.inner', query_group = 'locals', desc = 'Select language scope' },
- ['ia'] = { query = '@assignment.rhs', desc = 'Select assignment rhs' },
- ['ip'] = { query = '@parameter.inner', desc = 'Select parameter' },
- },
- selection_modes = {
- ['@parameter.outer'] = 'v', -- charwise
- ['@function.outer'] = 'V', -- linewise
- ['@class.outer'] = '<c-v>', -- blockwise
- ['@assignment.rhs'] = 'v', -- charwise
- },
- },
- swap = {
- enable = true,
- -- swap_next = {
- -- ['<leader>sa'] = { query = '@parameter.inner', desc = 'Swap Argument (next)' },
- -- },
- -- swap_previous = {
- -- ['<leader>sA'] = { query = '@parameter.inner', desc = 'Swap Argument (prev)' },
- -- },
- },
- },
- })
-
- local ts_repeat_move = require('nvim-treesitter.textobjects.repeatable_move')
- -- Repeat movement with ; and ,
- vim.keymap.set({ 'n', 'x', 'o' }, ';', ts_repeat_move.repeat_last_move_next)
- vim.keymap.set({ 'n', 'x', 'o' }, ',', ts_repeat_move.repeat_last_move_previous)
-
- -- NOTE: You need this, otherwise the normal ; and , won't work for fFtT
- vim.keymap.set({ 'n', 'x', 'o' }, 'f', ts_repeat_move.builtin_f_expr, { expr = true })
- vim.keymap.set({ 'n', 'x', 'o' }, 'F', ts_repeat_move.builtin_F_expr, { expr = true })
- vim.keymap.set({ 'n', 'x', 'o' }, 't', ts_repeat_move.builtin_t_expr, { expr = true })
- vim.keymap.set({ 'n', 'x', 'o' }, 'T', ts_repeat_move.builtin_T_expr, { expr = true })
- end,
-}
diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua
index 7fa7238..112723e 100644
--- a/.config/nvim/lua/plugins/snacks.lua
+++ b/.config/nvim/lua/plugins/snacks.lua
@@ -32,6 +32,7 @@ return {
filter = function(notif)
local exact_filter = { 'No information available', 'No code actions available' }
local contains_filter = {
+ 'lines',
'fewer lines',
'lines indented',
'lines yanked',