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.maps')
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
return {
"rmagatti/auto-session",
lazy = false,
priority = 100,
---@module "auto-session"
---@type AutoSession.Config
opts = {
MiniDeps.add({ source = 'https://github.com/rmagatti/auto-session' })
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)
require('auto-session').setup({
enabled = true,
auto_save = true,
auto_create = true,
@@ -28,17 +34,4 @@ return {
-- log_level = 'debug',
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'
---@type LazySpec
return { {
'saghen/blink.cmp',
event = 'InsertEnter',
version = '*',
build = 'cargo build --release',
dependencies = {
'saghen/blink.compat',
local function build_blink(params)
vim.notify('Building blink.cmp', vim.log.levels.INFO)
local obj = vim.system({ 'cargo', 'build', '--release' }, { cwd = params.path }):wait()
if obj.code == 0 then
vim.notify('Building blink.cmp done', vim.log.levels.INFO)
else
vim.notify('Building blink.cmp failed', vim.log.levels.ERROR)
end
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 = {
preset = 'none',
['<tab>'] = { 'accept', 'fallback' }, -- accept the snippet
@@ -59,11 +64,7 @@ return { {
use_proximity = true,
frecency = { enabled = true, },
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'
---@type LazySpec
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 = {
MiniDeps.add({ source = 'https://github.com/stevearc/conform.nvim' })
require('conform').setup({
notify_on_error = true,
formatters_by_ft = {
c = { 'clang-format' },
@@ -34,5 +17,7 @@ return { {
toml = { 'yq' },
xml = { 'yq' },
},
}
} }
})
Map('n', '<leader>f', function()
require('conform').format({ async = true, lsp_format = 'fallback' })
end, { desc = 'Format Buffer' })

View File

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

View File

@@ -1,12 +1,2 @@
---@module 'lazy'
---@type LazySpec
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
},
},
}, }
MiniDeps.add({ source = 'https://github.com/folke/lazydev.nvim' })
require('lazydev').setup()

View File

@@ -1,11 +1,5 @@
---@module 'lazy'
---@type LazySpec
return { {
'neovim/nvim-lspconfig',
event = { "BufReadPre", "BufNewFile" },
dependencies = { 'saghen/blink.cmp' },
---@type table<string, boolean|vim.lsp.Config>
opts = {
MiniDeps.add({ source = 'https://github.com/neovim/nvim-lspconfig' })
local opts = {
['clangd'] = false,
['ccls'] = true,
['glsl_analyzer'] = true,
@@ -30,14 +24,12 @@ return { {
},
},
},
},
---@param opts table<string,boolean|vim.lsp.Config>
config = function(_, opts)
-- store the default capabilities
local capabilities = require('blink.cmp').get_lsp_capabilities()
}
-- store the default capabilities
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- enable the LSP
for server, config in pairs(opts) do
-- enable the LSP
for server, config in pairs(opts) do
if type(config) == 'boolean' then
vim.lsp.enable(server, config)
else
@@ -46,6 +38,4 @@ return { {
config or {})
end
vim.lsp.config[server].capabilities = capabilities
end
end
} }
end

View File

@@ -1,5 +1,16 @@
return { {
'L3MON4D3/LuaSnip',
build = 'make install_jsregexp',
version = "v2.*",
} }
local function compile(params)
local obj = vim.system({ 'make', 'install_jsregexp' }, { cwd = params.path }):wait()
if obj.code == 0 then
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'
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 } })
MiniDeps.add({ source = 'https://github.com/nvim-mini/mini.nvim' })
require('mini.ai').setup() -- enhances the use of a/i textobjects
require('mini.align').setup() -- utility to align text in various ways
require('mini.comment').setup() -- for toggling comments inline
-- TODO: mini.completion to replace blink?
require('mini.move').setup() -- moving lines
require('mini.operators').setup() -- duplicating lines and evaluating equations inline
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
view = {
style = 'sign',
}
view = { style = 'sign' }
})
require('mini.files').setup({ -- file browser
content = {
@@ -104,12 +90,14 @@ require('mini.files').setup({ -- 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.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-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>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.hipatterns').setup({
highlighters = {
@@ -193,7 +181,3 @@ require('mini.statusline').setup({
})
require('mini.tabline').setup() -- shows buffers that are open
require('mini.trailspace').setup() -- trailing space indication and removal.
---@module 'lazy'
---@type LazySpec
return {}

View File

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

View File

@@ -1,28 +1,23 @@
---@module 'lazy'
---@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
local ts = require('nvim-treesitter')
ts.setup({ install_dir = vim.fn.stdpath('cache') .. '/tree-sitter' })
ts.install({
MiniDeps.add({ source = 'https://github.com/nvim-treesitter/nvim-treesitter' })
-- Pre-install a few languages we're (very) likely going to use
local ts = require('nvim-treesitter')
ts.setup({ install_dir = vim.fn.stdpath('cache') .. '/tree-sitter' })
ts.install({
'c', 'make',
'bash', 'gitignore', 'editorconfig',
'ini', 'json', 'yaml',
'markdown', 'markdown_inline',
})
})
-- Define aliases for entries that lack an entry, but should have one.
local alias = {
-- Define aliases for entries that lack an entry, but should have one.
local alias = {
{ 'sh', 'bash' },
}
}
local pat = vim.iter(alias):map(function(a) return a[1] end):totable()
vim.list_extend(pat, ts.get_available())
Autocmd('FileType', {
local pat = vim.iter(alias):map(function(a) return a[1] end):totable()
vim.list_extend(pat, ts.get_available())
Autocmd('FileType', {
pattern = pat,
callback = function(arg)
local a = vim.iter(alias)
@@ -34,6 +29,4 @@ return { {
end
vim.bo.ft = a[2] -- Retriggers function
end
})
end,
} }
})

View File

@@ -1,26 +1,18 @@
---@module 'lazy'
---@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",
MiniDeps.add({ source = 'https://github.com/akinsho/toggleterm.nvim' })
local tt = require('toggleterm')
local term = require('toggleterm.terminal')
tt.setup({
direction = 'float',
open_mapping = [[<C-\>]]
},
config = function(_, opts)
local tt = require('toggleterm')
local term = require('toggleterm.terminal')
tt.setup(opts)
})
local term_lazygit = term.Terminal:new({ cmd = "lazygit", hidden = true, direction = 'float' })
local term_lazygit = term.Terminal:new({ cmd = "lazygit", hidden = true, direction = 'float' })
-- Set mappings to toggle the above
Map({ 'n' }, '<leader>gg', function() term_lazygit:toggle() end)
-- Set mappings to toggle the above
Map({ 'n' }, '<leader>gg', function() term_lazygit:toggle() end)
-- Add a keymap for executing makefiles, or launch scripts
Map({ 'n', 't', 'v' }, '<c-b>', function()
-- Add a keymap for executing makefiles, or launch scripts
Map({ 'n', 't', 'v' }, '<c-b>', function()
local cwd = vim.fn.getcwd()
local cmd = nil
local launchcfg = cwd .. '/.launch.sh'
@@ -51,6 +43,4 @@ return { {
-- Execute the command in terminal 1
tt.exec(cmd, 1, nil, nil, nil, nil, false, true)
end, { desc = 'compile the program using .buildcofig placed in PWD' })
end
} }
end, { desc = 'compile the program using .buildcofig placed in PWD' })