dotfiles/modules/programs/nvim/plugins/mini-nvim.lua

73 lines
2.5 KiB
Lua
Raw Normal View History

2023-05-28 18:23:25 +02:00
require("mini.align").setup()
require("mini.comment").setup()
require("mini.surround").setup()
require("mini.move").setup()
require("mini.pairs").setup()
require("mini.starter").setup()
require("mini.tabline").setup()
local tabline_current = vim.api.nvim_get_hl(0, { name = "MiniTablineCurrent" })
vim.api.nvim_set_hl(0, "MiniTablineCurrent", {
fg = tabline_current.fg,
bg = tabline_current.bg,
bold = true,
italic = true,
})
require("mini.statusline").setup({
content = {
active = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
local git = MiniStatusline.section_git({ trunc_width = 75 })
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
local location = MiniStatusline.section_location({ trunc_width = 75 })
local mode_hl_inverse = mode_hl .. "Inverse"
-- Usage of `MiniStatusline.combine_groups()` ensures highlighting and
-- correct padding with spaces between groups (accounts for 'missing'
-- sections, etc.)
return MiniStatusline.combine_groups({
{ hl = mode_hl_inverse, strings = {} },
"",
{ hl = mode_hl, strings = { mode } },
{ hl = "MiniStatuslineDevinfo", strings = { git, diagnostics } },
"%<", -- Mark general truncate point
{ hl = "MiniStatuslineFilename", strings = { filename } },
"%=", -- End left alignment
{ hl = "MiniStatuslineFileinfo", strings = { fileinfo } },
{ hl = mode_hl, strings = { location } },
{ hl = mode_hl_inverse, strings = {} },
"",
})
end,
},
})
local MiniStatuslineModes = {
"MiniStatuslineModeInsert",
"MiniStatuslineModeNormal",
"MiniStatuslineModeReplace",
"MiniStatuslineModeVisual",
"MiniStatuslineModeCommand",
"MiniStatuslineModeOther",
}
for _, mode_hl in ipairs(MiniStatuslineModes) do
local hl_table = vim.api.nvim_get_hl(0, { name = mode_hl })
local fg = hl_table.fg
hl_table.fg = hl_table.bg
hl_table.bg = fg
vim.api.nvim_set_hl(0, mode_hl .. "Inverse", hl_table)
end
local animate = require("mini.animate")
local animation = {
timing = animate.gen_timing.quadratic({ duration = 100, unit = "total" }),
}
animate.setup({
cursor = animation,
scroll = { enable = false },
resize = animation,
open = animation,
close = animation,
})