Remove lazy in favour of mini.deps

This commit is contained in:
2026-01-27 22:48:54 +01:00
parent 281589bf18
commit b7d4836f9f
14 changed files with 339 additions and 419 deletions

View File

@@ -1,4 +1,4 @@
require('config.opts') require('config.opts')
require('config.maps') require('config.maps')
require('config.autocmds') require('config.autocmds')
require('config.lazy') require('config.plug')

View File

@@ -1,24 +0,0 @@
-- bootstrap lazy
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
}, true, {})
return 1
end
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
change_detection = { enabled = false },
defaults = {
lazy = true,
},
spec = { { import = 'plugin' } },
})
Map('n', '<leader>L', '<cmd>Lazy<cr>', { desc = 'open Lazy' })

View File

@@ -0,0 +1,26 @@
-- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
local pkgpat = vim.fn.stdpath('data') .. '/site/'
local minipat = pkgpat .. 'pack/deps/start/mini.nvim'
if not vim.uv.fs_stat(minipat) 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', minipat
}
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.deps').setup({ path = { package = pkgpat } })
require('plugin.auto-session')
require('plugin.blink-cmp')
require('plugin.conform')
require('plugin.gruvbox')
require('plugin.lazydev')
require('plugin.lspconfig')
require('plugin.luasnip')
require('plugin.mini')
require('plugin.nvim-lint')
require('plugin.nvim-treesitter')
require('plugin.toggleterm')

View File

@@ -1,11 +1,17 @@
---@type LazySpec MiniDeps.add({ source = 'https://github.com/rmagatti/auto-session' })
return {
"rmagatti/auto-session", local path = vim.fn.argv(0)
lazy = false, if not path or type(path) ~= 'string' then return end
priority = 100,
---@module "auto-session" local realpath = vim.uv.fs_realpath(path)
---@type AutoSession.Config if not realpath then return end
opts = {
if vim.fn.isdirectory(realpath) ~= 1 then return end
vim.fn.chdir(realpath)
vim.notify("loaded directory: '" .. realpath .. "'", vim.log.levels.INFO)
require('auto-session').setup({
enabled = true, enabled = true,
auto_save = true, auto_save = true,
auto_create = true, auto_create = true,
@@ -28,17 +34,4 @@ return {
-- log_level = 'debug', -- log_level = 'debug',
show_auto_restore_notif = true, show_auto_restore_notif = true,
}, })
init = function()
local path = vim.fn.argv(0)
if not path or type(path) ~= 'string' then return end
local realpath = vim.uv.fs_realpath(path)
if not realpath then return end
if vim.fn.isdirectory(realpath) ~= 1 then return end
vim.fn.chdir(realpath)
vim.notify("loaded directory: '" .. realpath .. "'", vim.log.levels.INFO)
end,
}

View File

@@ -1,16 +1,21 @@
---@module 'lazy' local function build_blink(params)
---@type LazySpec vim.notify('Building blink.cmp', vim.log.levels.INFO)
return { { local obj = vim.system({ 'cargo', 'build', '--release' }, { cwd = params.path }):wait()
'saghen/blink.cmp', if obj.code == 0 then
event = 'InsertEnter', vim.notify('Building blink.cmp done', vim.log.levels.INFO)
version = '*', else
build = 'cargo build --release', vim.notify('Building blink.cmp failed', vim.log.levels.ERROR)
dependencies = { end
'saghen/blink.compat', end
MiniDeps.add({
source = 'https://github.com/saghen/blink.cmp',
hooks = {
post_install = build_blink,
post_checkout = build_blink,
}, },
---@module 'blink.cmp' })
---@type blink.cmp.Config
opts = { require('blink.cmp').setup({
keymap = { keymap = {
preset = 'none', preset = 'none',
['<tab>'] = { 'accept', 'fallback' }, -- accept the snippet ['<tab>'] = { 'accept', 'fallback' }, -- accept the snippet
@@ -59,11 +64,7 @@ return { {
use_proximity = true, use_proximity = true,
frecency = { enabled = true, }, frecency = { enabled = true, },
prebuilt_binaries = { prebuilt_binaries = {
download = false, -- we are building from source download = true, -- we are building from source
} }
} }
}, })
config = function(_, opts)
require("blink.cmp").setup(opts)
end
} }

View File

@@ -1,22 +1,5 @@
---@module 'lazy' MiniDeps.add({ source = 'https://github.com/stevearc/conform.nvim' })
---@type LazySpec require('conform').setup({
return { {
'stevearc/conform.nvim', -- allows you to format a buffer
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' } -- execute the formatter
-- vim.cmd [[keepjumps keeppatterns %s/\s\+$//e]] -- removes trailing whitespace
end,
mode = 'n',
desc = '[f]ormat buffer',
},
},
---@type conform.setupOpts
opts = {
notify_on_error = true, notify_on_error = true,
formatters_by_ft = { formatters_by_ft = {
c = { 'clang-format' }, c = { 'clang-format' },
@@ -34,5 +17,7 @@ return { {
toml = { 'yq' }, toml = { 'yq' },
xml = { 'yq' }, xml = { 'yq' },
}, },
} })
} } Map('n', '<leader>f', function()
require('conform').format({ async = true, lsp_format = 'fallback' })
end, { desc = 'Format Buffer' })

View File

@@ -1,26 +1,16 @@
---@module 'lazy' MiniDeps.add({ source = 'https://github.com/ellisonleao/gruvbox.nvim' })
---@type LazySpec local colour = require('gruvbox')
return { { colour.setup({
'ellisonleao/gruvbox.nvim',
lazy = false,
priority = 1000,
---@module 'gruvbox'
---@type GruvboxConfig
opts = {
styles = { styles = {
comments = { italic = true } comments = { italic = true }
} }
}, })
config = function(_, opts)
local colour = require('gruvbox')
colour.setup(opts)
vim.cmd.colorscheme('gruvbox') vim.cmd.colorscheme('gruvbox')
_G.userdat.palette = colour.palette _G.userdat.palette = colour.palette
-- non-essential configuration should be put in here -- non-essential configuration should be put in here
Autocmd('VimEnter', { Autocmd('VimEnter', {
callback = callback = function()
function()
-- spell highlight must be grey -- spell highlight must be grey
for _, spell in pairs { 'SpellBad', 'SpellCap', 'SpellRare', 'SpellLocal' } do for _, spell in pairs { 'SpellBad', 'SpellCap', 'SpellRare', 'SpellLocal' } do
vim.api.nvim_set_hl(0, spell, vim.api.nvim_set_hl(0, spell,
@@ -28,5 +18,3 @@ return { {
end end
end end
}) })
end
} }

View File

@@ -1,12 +1,2 @@
---@module 'lazy' MiniDeps.add({ source = 'https://github.com/folke/lazydev.nvim' })
---@type LazySpec require('lazydev').setup()
return { {
'folke/lazydev.nvim', -- provides the lua LSP for the neovim config.
event = 'VeryLazy',
ft = 'lua',
opts = {
library = {
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } }, -- load luvit types when the `vim.uv` word is found
},
},
}, }

View File

@@ -1,11 +1,5 @@
---@module 'lazy' MiniDeps.add({ source = 'https://github.com/neovim/nvim-lspconfig' })
---@type LazySpec local opts = {
return { {
'neovim/nvim-lspconfig',
event = { "BufReadPre", "BufNewFile" },
dependencies = { 'saghen/blink.cmp' },
---@type table<string, boolean|vim.lsp.Config>
opts = {
['clangd'] = false, ['clangd'] = false,
['ccls'] = true, ['ccls'] = true,
['glsl_analyzer'] = true, ['glsl_analyzer'] = true,
@@ -30,9 +24,7 @@ return { {
}, },
}, },
}, },
}, }
---@param opts table<string,boolean|vim.lsp.Config>
config = function(_, opts)
-- store the default capabilities -- store the default capabilities
local capabilities = require('blink.cmp').get_lsp_capabilities() local capabilities = require('blink.cmp').get_lsp_capabilities()
@@ -47,5 +39,3 @@ return { {
end end
vim.lsp.config[server].capabilities = capabilities vim.lsp.config[server].capabilities = capabilities
end end
end
} }

View File

@@ -1,5 +1,16 @@
return { { local function compile(params)
'L3MON4D3/LuaSnip', local obj = vim.system({ 'make', 'install_jsregexp' }, { cwd = params.path }):wait()
build = 'make install_jsregexp', if obj.code == 0 then
version = "v2.*", vim.notify('Building lacmp done', vim.log.levels.INFO)
} } else
vim.notify('Building blink.cmp failed', vim.log.levels.ERROR)
end
end
MiniDeps.add({
source = 'https://github.com/L3MON4D3/LuaSnip',
hooks = {
post_install = compile,
post_checkout = compile,
}
})

View File

@@ -1,21 +1,9 @@
-- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps' MiniDeps.add({ source = 'https://github.com/nvim-mini/mini.nvim' })
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.deps').setup({ path = { package = path_package } })
require('mini.ai').setup() -- enhances the use of a/i textobjects require('mini.ai').setup() -- enhances the use of a/i textobjects
require('mini.align').setup() -- utility to align text in various ways require('mini.align').setup() -- utility to align text in various ways
require('mini.comment').setup() -- for toggling comments inline require('mini.comment').setup() -- for toggling comments inline
-- TODO: mini.completion to replace blink?
require('mini.move').setup() -- moving lines require('mini.move').setup() -- moving lines
require('mini.operators').setup() -- duplicating lines and evaluating equations inline require('mini.operators').setup() -- duplicating lines and evaluating equations inline
require('mini.pairs').setup() -- automatic closing pairs require('mini.pairs').setup() -- automatic closing pairs
@@ -65,9 +53,7 @@ require('mini.clue').setup({ -- shows available keybinds when performing ke
}, },
}) })
require('mini.diff').setup({ -- shows git diffs in the file require('mini.diff').setup({ -- shows git diffs in the file
view = { view = { style = 'sign' }
style = 'sign',
}
}) })
require('mini.files').setup({ -- file browser require('mini.files').setup({ -- file browser
content = { content = {
@@ -104,12 +90,14 @@ require('mini.files').setup({ -- file browser
Map('n', '<leader>o', MiniFiles.open, { desc = "Open mini file browser" }) Map('n', '<leader>o', MiniFiles.open, { desc = "Open mini file browser" })
require('mini.jump').setup() -- extends f,F,t,T to work across multiple lines require('mini.jump').setup() -- extends f,F,t,T to work across multiple lines
require('mini.pick').setup() require('mini.pick').setup()
require('mini.extra').setup()
Map('n', '<c-s>', MiniPick.builtin.resume, { desc = "Resume Previous Search" })
Map('n', '<c-p>', MiniPick.builtin.files, { desc = "File Picker" }) Map('n', '<c-p>', MiniPick.builtin.files, { desc = "File Picker" })
Map('n', '<c-g>', MiniPick.builtin.live_grep, { desc = "Live Grep" }) Map('n', '<c-g>', MiniPick.builtin.grep_live, { desc = "Live Grep" })
Map('n', '<leader>p', MiniPick.builtin.files, { desc = "File Picker" }) Map('n', '<leader>p', MiniPick.builtin.files, { desc = "File Picker" })
Map('n', '<leader>sg', MiniPick.builtin.grep_live, { desc = "Search Live Grep" }) Map('n', '<leader>sg', MiniPick.builtin.grep_live, { desc = "Search Live Grep" })
Map('n', '<leader>sd', MiniExtra.pickers.diagnositc, { desc = "Search Diagnostics" }) Map('n', '<leader>sd', MiniExtra.pickers.diagnostic, { desc = "Search Diagnostics" })
-- TODO: Use mini.sessions?
require('mini.cursorword').setup() -- highlight words beneath the cursor require('mini.cursorword').setup() -- highlight words beneath the cursor
require('mini.hipatterns').setup({ require('mini.hipatterns').setup({
highlighters = { highlighters = {
@@ -193,7 +181,3 @@ require('mini.statusline').setup({
}) })
require('mini.tabline').setup() -- shows buffers that are open require('mini.tabline').setup() -- shows buffers that are open
require('mini.trailspace').setup() -- trailing space indication and removal. require('mini.trailspace').setup() -- trailing space indication and removal.
---@module 'lazy'
---@type LazySpec
return {}

View File

@@ -1,16 +1,7 @@
---@module 'lazy' MiniDeps.add({ source = 'https://github.com/mfussenegger/nvim-lint' })
---@type LazySpec local lint = require('lint')
return { {
'mfussenegger/nvim-lint', local linters = {
event = { 'BufWritePost', 'BufReadPost', 'TextChanged' },
---@module 'lint'
opts = {
---@type table<string, string[]>
linters_by_ft = {
sh = { 'shellcheck' },
glsl = { 'glslang' },
},
linters = {
glslang = { glslang = {
cmd = 'glslangValidator', cmd = 'glslangValidator',
stdin = false, stdin = false,
@@ -21,8 +12,10 @@ return { {
for _, line in ipairs(vim.split(output, '\n')) do for _, line in ipairs(vim.split(output, '\n')) do
local f, lnum, sev, msg = line:match( local f, lnum, sev, msg = line:match(
'^([^:]+):(%d+):%s+([^:]+):%s+(.+)$') -- file:line: severity: message '^([^:]+):(%d+):%s+([^:]+):%s+(.+)$') -- file:line: severity: message
if not f then sev, f, lnum, msg = line:match( if not f then
'^(%w+):%s+([^:]+):(%d+):%s+(.+)$') end -- severity: file:line: message sev, f, lnum, msg = line:match(
'^(%w+):%s+([^:]+):(%d+):%s+(.+)$')
end -- severity: file:line: message
if lnum then if lnum then
local s = sev:lower() == 'error' local s = sev:lower() == 'error'
@@ -41,17 +34,17 @@ return { {
end end
} }
} }
},
config = function(_, opts)
local lint = require('lint')
lint.linters_by_ft = opts.linters_by_ft
for name, linter in pairs(opts.linters) do
lint.linters_by_ft = {
sh = { 'shellcheck' },
glsl = { 'glslang' },
}
for name, linter in pairs(linters) do
lint.linters[name] = linter lint.linters[name] = linter
end end
-- autocommand for linting -- autocommand for linting
Autocmd({ 'BufWritePost', 'BufWinEnter', 'TextChanged' }, Autocmd({ 'BufWritePost', 'BufWinEnter', 'TextChanged' },
{ callback = function() lint.try_lint() end }); { callback = function() lint.try_lint() end });
end
} }

View File

@@ -1,10 +1,5 @@
---@module 'lazy' MiniDeps.add({ source = 'https://github.com/nvim-treesitter/nvim-treesitter' })
---@type LazySpec
return { {
'nvim-treesitter/nvim-treesitter', -- highlight, edit, and navigate code
build = ':TSUpdate',
lazy = false,
config = function()
-- Pre-install a few languages we're (very) likely going to use -- Pre-install a few languages we're (very) likely going to use
local ts = require('nvim-treesitter') local ts = require('nvim-treesitter')
ts.setup({ install_dir = vim.fn.stdpath('cache') .. '/tree-sitter' }) ts.setup({ install_dir = vim.fn.stdpath('cache') .. '/tree-sitter' })
@@ -35,5 +30,3 @@ return { {
vim.bo.ft = a[2] -- Retriggers function vim.bo.ft = a[2] -- Retriggers function
end end
}) })
end,
} }

View File

@@ -1,18 +1,10 @@
---@module 'lazy' MiniDeps.add({ source = 'https://github.com/akinsho/toggleterm.nvim' })
---@type LazySpec
return { {
'akinsho/toggleterm.nvim', -- allows to toggle the terminal rather than open one in a separate window
event = 'VeryLazy',
---@type ToggleTermConfig
---@diagnostic disable-next-line: missing-fields
opts = {
direction = "float",
open_mapping = [[<C-\>]]
},
config = function(_, opts)
local tt = require('toggleterm') local tt = require('toggleterm')
local term = require('toggleterm.terminal') local term = require('toggleterm.terminal')
tt.setup(opts) tt.setup({
direction = 'float',
open_mapping = [[<C-\>]]
})
local term_lazygit = term.Terminal:new({ cmd = "lazygit", hidden = true, direction = 'float' }) local term_lazygit = term.Terminal:new({ cmd = "lazygit", hidden = true, direction = 'float' })
@@ -52,5 +44,3 @@ return { {
-- Execute the command in terminal 1 -- Execute the command in terminal 1
tt.exec(cmd, 1, nil, nil, nil, nil, false, true) tt.exec(cmd, 1, nil, nil, nil, nil, false, true)
end, { desc = 'compile the program using .buildcofig placed in PWD' }) end, { desc = 'compile the program using .buildcofig placed in PWD' })
end
} }