Files
.dotfiles/plug.lua
2025-11-23 02:07:01 +01:00

144 lines
6.2 KiB
Lua

-- 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
-- Set up Mini stuff
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
require('mini.completion').setup() -- for providing autocompletion results TODO: not up-to-par for my normal things
require('mini.move').setup() -- moving lines
require('mini.operators').setup() -- duplicating lines and evaluating equations inline
require('mini.pairs').setup() -- automatic closing pairs TODO: write logic for \033[ escape codes (again)
require('mini.surround').setup() -- surround stuff
require('mini.clue').setup({ -- shows available keybinds when performing keybind actions
window = { delay = 50 },
-- TODO: have this appear more often
triggers = {
-- Leader triggers
{ mode = 'n', keys = '<Leader>' },
{ mode = 'x', keys = '<Leader>' },
-- Built-in completion
{ mode = 'i', keys = '<C-x>' },
-- `g` key
{ mode = 'n', keys = 'g' },
{ mode = 'x', keys = 'g' },
-- Marks
{ mode = 'n', keys = "'" },
{ mode = 'n', keys = '`' },
{ mode = 'x', keys = "'" },
{ mode = 'x', keys = '`' },
-- Registers
{ mode = 'n', keys = '"' },
{ mode = 'x', keys = '"' },
{ mode = 'i', keys = '<C-r>' },
{ mode = 'c', keys = '<C-r>' },
-- Window commands
{ mode = 'n', keys = '<C-w>' },
-- `z` key
{ mode = 'n', keys = 'z' },
{ mode = 'x', keys = 'z' },
},
clues = {
-- Enhance this by adding descriptions for <Leader> mapping groups
require('mini.clue').gen_clues.builtin_completion(),
require('mini.clue').gen_clues.g(),
require('mini.clue').gen_clues.marks(),
require('mini.clue').gen_clues.registers(),
require('mini.clue').gen_clues.windows(),
require('mini.clue').gen_clues.z(),
},
})
require('mini.diff').setup({ -- shows git diffs in the file
style = 'sign',
})
require('mini.files').setup({ -- file browser
-- TODO: customise with some sensible keybindings
})
require('mini.jump').setup() -- extends f,F,t,T to work across multiple lines
require('mini.pick').setup() -- picker/browser for various occasions TODO: research to potentially replace telescope.
require('mini.sessions').setup() -- for loading / creating sessions TODO: replace the AWFUL session management I keep bickering with with this, (I hope).
require('mini.cursorword').setup() -- highlight words beneath the cursor
require('mini.hipatterns').setup({
-- TODO: look into replacing folke todo comments with this
})
require('mini.icons').setup() -- TODO: replace devicons with it (telescope)
require('mini.indentscope').setup({ -- shows our current indent level
draw = {
delay = 50,
animation = require('mini.indentscope').gen_animation.none(),
}
})
vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { link = 'Whitespace' })
require('mini.notify').setup() -- has more noticeable / utilitarian / aesthetically pleasing notifications
require('mini.statusline').setup({
content = {
-- TODO: I still want the all-caps modal things, and likely farther customisations.
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({ -- TODO: what the heck is happening here?
{},
})
end
},
use_icons = true,
set_vim_settings = true,
})
require('mini.tabline').setup({
-- TODO: port keybindings from the older configuration
})
require('mini.trailspace').setup() -- trailing space indication and removal.
-- Set up mini.deps, and add the plugins we'll need to use.
require('mini.deps').setup({ path = { package = path_package } })
local add = MiniDeps.add
add({ source = 'https://github.com/rmagatti/auto-session' })
add({ source = 'https://github.com/saghen/blink.cmp' })
add({ source = 'https://github.com/stevearc/conform.nvim' })
add({ source = 'https://github.com/ellisonleao/gruvbox.nvim' })
add({ source = 'https://github.com/folke/lazydev.nvim' })
add({ source = 'https://github.com/lmburns/lf.nvim', depends = { 'https://github.com/akinsho/toggleterm.nvim' } })
add({ source = 'https://github.com/ray-x/lsp_signature.nvim' })
add({ source = 'https://github.com/neovim/nvim-lspconfig' })
add({ source = 'https://github.com/L3MON4D3/LuaSnip' })
add({ source = 'https://github.com/mfussenegger/nvim-lint' })
add({ source = 'https://github.com/nvim-treesitter/nvim-treesitter' })
add({ source = 'https://github.com/nvim-telescope/telescope.nvim', depends = { 'https://github.com/nvim-lua/plenary.nvim', 'nvim-telescope/telescope-ui-select.nvim', 'nvim-tree/nvim-web-devicons', 'nvim-telescope/telescope-fzf-native.nvim' } })
add({ source = 'https://github.com/folke/todo-comments.nvim', depends = { 'https://github.com/nvim-lua/plenary.nvim' } })
add({ source = 'https://github.com/akinsho/toggleterm.nvim' })