nvim: Move mini configuration into core plugin file
Since I would like to keep my plugin configurations as modular as possible I think it is a good first step to move the mini configuration directly into the core plugin file where mini is loaded. Since this is the plugin spec I want to take to basically any nvim installation I have, having it in a single file makes it much easier to be portable.
This commit is contained in:
parent
7c37baa565
commit
0c7ad09789
2 changed files with 77 additions and 80 deletions
|
@ -1,79 +0,0 @@
|
|||
-- automatic callback to invoke 'mini.base16' when colorscheme file is changed
|
||||
local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua"
|
||||
local function source_colors()
|
||||
if vim.fn.filereadable(colorsfile) == 1 then
|
||||
vim.cmd("source " .. colorsfile)
|
||||
end
|
||||
end
|
||||
-- set on startup
|
||||
source_colors()
|
||||
|
||||
-- continuously watch colors file for changes
|
||||
local fwatch = require("fwatch")
|
||||
fwatch.watch(colorsfile, {
|
||||
on_event = vim.schedule_wrap(function()
|
||||
source_colors()
|
||||
end),
|
||||
})
|
||||
|
||||
require("mini.ai").setup()
|
||||
require("mini.comment").setup({
|
||||
hooks = {
|
||||
pre = function()
|
||||
require("ts_context_commentstring.internal").update_commentstring()
|
||||
end,
|
||||
},
|
||||
})
|
||||
require("mini.cursorword").setup({ delay = 500 })
|
||||
require("mini.fuzzy").setup()
|
||||
|
||||
require("mini.indentscope").setup({
|
||||
symbol = "│",
|
||||
draw = { animation = require("mini.indentscope").gen_animation.none() },
|
||||
options = { indent_at_cursor = false },
|
||||
})
|
||||
|
||||
require("mini.map").setup()
|
||||
require("mini.move").setup()
|
||||
require("mini.operators").setup()
|
||||
require("mini.pairs").setup()
|
||||
require("mini.trailspace").setup()
|
||||
|
||||
local starter = require("mini.starter")
|
||||
starter.setup({
|
||||
evaluate_single = true,
|
||||
items = {
|
||||
starter.sections.builtin_actions(),
|
||||
starter.sections.recent_files(10, true),
|
||||
starter.sections.recent_files(10, false),
|
||||
-- Use this if you set up 'mini.sessions'
|
||||
-- starter.sections.sessions(),
|
||||
starter.sections.telescope(),
|
||||
},
|
||||
content_hooks = {
|
||||
starter.gen_hook.adding_bullet(),
|
||||
starter.gen_hook.padding(3, 2),
|
||||
starter.gen_hook.aligning("center", "center"),
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true })
|
||||
|
||||
require("mini.bracketed").setup({
|
||||
{
|
||||
buffer = { suffix = "b", options = {} },
|
||||
comment = { suffix = "c", options = {} },
|
||||
conflict = { suffix = "", options = {} },
|
||||
diagnostic = { suffix = "d", options = {} },
|
||||
file = { suffix = "f", options = {} },
|
||||
indent = { suffix = "", options = {} }, -- disable since we use indentscope above
|
||||
jump = { suffix = "j", options = {} },
|
||||
location = { suffix = "l", options = {} },
|
||||
oldfile = { suffix = "o", options = {} },
|
||||
quickfix = { suffix = "q", options = {} },
|
||||
treesitter = { suffix = "t", options = {} },
|
||||
undo = { suffix = "", options = {} }, -- disable since I don't need it
|
||||
window = { suffix = "w", options = {} },
|
||||
yank = { suffix = "y", options = {} },
|
||||
},
|
||||
})
|
|
@ -59,7 +59,83 @@ return {
|
|||
version = "*",
|
||||
dependencies = { "rktjmp/fwatch.nvim" },
|
||||
config = function()
|
||||
require("plugins.config.mini")
|
||||
-- automatic callback to invoke 'mini.base16' when colorscheme file is changed
|
||||
local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua"
|
||||
local function source_colors()
|
||||
if vim.fn.filereadable(colorsfile) == 1 then
|
||||
vim.cmd("source " .. colorsfile)
|
||||
end
|
||||
end
|
||||
-- set on startup
|
||||
source_colors()
|
||||
-- continuously watch colors file for changes
|
||||
local fwatch = require("fwatch")
|
||||
fwatch.watch(colorsfile, {
|
||||
on_event = vim.schedule_wrap(function()
|
||||
source_colors()
|
||||
end),
|
||||
})
|
||||
|
||||
require("mini.ai").setup()
|
||||
require("mini.comment").setup({
|
||||
hooks = {
|
||||
pre = function()
|
||||
-- use treesitter commentstring functionality if it's installed
|
||||
if require("util").is_available("ts_context_commentstring") then
|
||||
require("ts_context_commentstring.internal").update_commentstring()
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
require("mini.cursorword").setup({ delay = 500 })
|
||||
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true, underline = false })
|
||||
vim.api.nvim_set_hl(0, "MiniCursorwordCurrent", { bold = true, underline = false })
|
||||
require("mini.fuzzy").setup()
|
||||
require("mini.indentscope").setup({
|
||||
symbol = "│",
|
||||
draw = { animation = require("mini.indentscope").gen_animation.none() },
|
||||
options = { indent_at_cursor = false },
|
||||
})
|
||||
require("mini.map").setup()
|
||||
require("mini.move").setup()
|
||||
require("mini.operators").setup()
|
||||
require("mini.pairs").setup()
|
||||
require("mini.trailspace").setup()
|
||||
local starter = require("mini.starter")
|
||||
starter.setup({
|
||||
evaluate_single = true,
|
||||
items = {
|
||||
starter.sections.builtin_actions(),
|
||||
starter.sections.recent_files(10, true),
|
||||
starter.sections.recent_files(10, false),
|
||||
-- Use this if you set up 'mini.sessions'
|
||||
-- starter.sections.sessions(),
|
||||
starter.sections.telescope(),
|
||||
},
|
||||
content_hooks = {
|
||||
starter.gen_hook.adding_bullet(),
|
||||
starter.gen_hook.padding(3, 2),
|
||||
starter.gen_hook.aligning("center", "center"),
|
||||
},
|
||||
})
|
||||
require("mini.bracketed").setup({
|
||||
{
|
||||
buffer = { suffix = "b", options = {} },
|
||||
comment = { suffix = "c", options = {} },
|
||||
conflict = { suffix = "", options = {} },
|
||||
diagnostic = { suffix = "d", options = {} },
|
||||
file = { suffix = "f", options = {} },
|
||||
indent = { suffix = "", options = {} }, -- disable since we use indentscope above
|
||||
jump = { suffix = "j", options = {} },
|
||||
location = { suffix = "l", options = {} },
|
||||
oldfile = { suffix = "o", options = {} },
|
||||
quickfix = { suffix = "q", options = {} },
|
||||
treesitter = { suffix = "t", options = {} },
|
||||
undo = { suffix = "", options = {} }, -- disable since I don't need it
|
||||
window = { suffix = "w", options = {} },
|
||||
yank = { suffix = "y", options = {} },
|
||||
},
|
||||
})
|
||||
end,
|
||||
event = "VimEnter", -- need to load pretty soon for Starter screen
|
||||
keys = {
|
||||
|
|
Loading…
Reference in a new issue