From 3507dc0ca178392ea46816eb9f915f0e722f86d2 Mon Sep 17 00:00:00 2001 From: Quinn Date: Sun, 23 Nov 2025 00:40:05 +0100 Subject: [PATCH] seperate out mini from lazy.nvim --- .config/nvim/lua/plugin/mini.lua | 151 +++++++++++++++++-------------- 1 file changed, 81 insertions(+), 70 deletions(-) diff --git a/.config/nvim/lua/plugin/mini.lua b/.config/nvim/lua/plugin/mini.lua index 81124e1..2350f91 100644 --- a/.config/nvim/lua/plugin/mini.lua +++ b/.config/nvim/lua/plugin/mini.lua @@ -1,72 +1,83 @@ +-- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps' +local path_package = vim.fn.stdpath('data') .. '/site/' +local mini_path = path_package .. 'pack/deps/start/mini.nvim' +if not (vim.uv or vim.loop).fs_stat(mini_path) then + vim.cmd('echo "Installing [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw') + local clone_cmd = { + 'git', 'clone', '--filter=blob:none', + 'https://github.com/nvim-mini/mini.nvim', mini_path + } + vim.fn.system(clone_cmd) + vim.cmd('packadd mini.nvim | helptags ALL') + vim.cmd('echo "Installed [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw') +end + +require('mini.ai').setup() +require('mini.surround').setup() +require('mini.operators').setup() + +require('mini.indentscope').setup({ + symbol = '¦', + draw = { + delay = 50, -- delay in MS before writing the indicator + animation = require('mini.indentscope').gen_animation.none(), + }, + options = { + try_as_border = false, + }, +}) +vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { fg = _G.userdat.palette.dark2, bg = nil }) + +require('mini.move').setup({ + mappings = { + -- move visual selection in visual mode + left = '', + down = '', + up = '', + right = '', + + -- move current line in normal mode + line_left = '', + line_down = '', + line_up = '', + line_right = '', + }, + options = { + reindent_linewise = true, -- automatically re-indent selection during line vertical move + }, +}) + +require('mini.statusline').setup({ + content = { + active = function() + local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) + local git = MiniStatusline.section_git({ trunc_width = 40 }) + local diff = MiniStatusline.section_diff({ trunc_width = 75 }) + local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 }) + local lsp = MiniStatusline.section_lsp({ trunc_width = 75 }) + local filename = MiniStatusline.section_filename({ trunc_width = 140 }) + local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) + + return MiniStatusline.combine_groups({ + { hl = mode_hl, strings = { mode } }, + { hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } }, + '%<', -- general truncation point + { hl = 'MiniStatuslineFilename', strings = { filename } }, + '%=', -- align right + { hl = 'MiniStatuslineFileInfo', strings = { fileinfo } }, + { hl = mode_hl, strings = { '%3l:%-3c' } } + }) + end, + inactive = function() + return MiniStatusline.combine_groups({ + {}, + }) + end + }, + use_icons = true, + set_vim_settings = true, +}) + ---@module 'lazy' ---@type LazySpec -return { { - 'nvim-mini/mini.nvim', - config = function() - require('mini.ai').setup() - require('mini.surround').setup() - require('mini.operators').setup() - - require('mini.indentscope').setup({ - symbol = '¦', - draw = { - delay = 50, -- delay in MS before writing the indicator - animation = require('mini.indentscope').gen_animation.none(), - }, - options = { - try_as_border = false, - }, - }) - vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { fg = _G.userdat.palette.dark2, bg = nil }) - - require('mini.move').setup({ - mappings = { - -- move visual selection in visual mode - left = '', - down = '', - up = '', - right = '', - - -- move current line in normal mode - line_left = '', - line_down = '', - line_up = '', - line_right = '', - }, - options = { - reindent_linewise = true, -- automatically re-indent selection during line vertical move - }, - }) - - require('mini.statusline').setup({ - content = { - active = function() - local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) - local git = MiniStatusline.section_git({ trunc_width = 40 }) - local diff = MiniStatusline.section_diff({ trunc_width = 75 }) - local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 }) - local lsp = MiniStatusline.section_lsp({ trunc_width = 75 }) - local filename = MiniStatusline.section_filename({ trunc_width = 140 }) - local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) - - return MiniStatusline.combine_groups({ - { hl = mode_hl, strings = { mode } }, - { hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } }, - '%<', -- general truncation point - { hl = 'MiniStatuslineFilename', strings = { filename } }, - '%=', -- align right - { hl = 'MiniStatuslineFileInfo', strings = { fileinfo } }, - { hl = mode_hl, strings = { '%3l:%-3c' } } - }) - end, - inactive = function() - return MiniStatusline.combine_groups({ - {}, - }) - end - }, - use_icons = true, - set_vim_settings = true, - }) - end -} } +return {}