require("mini.notify").setup({ lsp_progress = { enable = false }, }) local misc = require("mini.misc") misc.setup_restore_cursor() misc.setup_termbg_sync() vim.schedule(function() local snippets = require("mini.snippets") snippets.setup({ snippets = { snippets.gen_loader.from_lang(), }, }) local fin_stop = function(args) if args.data.tabstop_to == "0" then snippets.session.stop() end end local au_opts = { pattern = "MiniSnippetsSessionJump", callback = fin_stop } vim.api.nvim_create_autocmd("User", au_opts) end) vim.schedule(function() local hipatterns = require("mini.hipatterns") hipatterns.setup({ highlighters = { fixme = { pattern = "FIXME", group = "MiniHipatternsFixme" }, todo = { pattern = "TODO", group = "MiniHipatternsTodo" }, note = { pattern = "NOTE", group = "MiniHipatternsNote" }, hex_color = hipatterns.gen_highlighter.hex_color(), }, }) end) vim.schedule(function() require("mini.icons").setup() end) local section_filename = function() local st = "%{% &busy > 0 ? '◐ ' : '' %}" -- In terminal always use plain name if vim.bo.buftype == "terminal" then return st .. "%t" elseif _G.MiniStatusline.is_truncated(140) then -- File name with 'truncate', 'modified', 'readonly' flags -- Use relative path if truncated return st .. "%f%m%r" else -- Use fullpath if not truncated return st .. "%F%m%r" end end local section_git = function() if _G.MiniStatusline.is_truncated(40) then return "" end local summary = vim.b.gitsigns_head if summary == nil then return "" end return " " .. (summary == "" and "-" or summary) end local section_diff = function() if _G.MiniStatusline.is_truncated(75) then return "" end local summary = vim.b.gitsigns_status if summary == nil then return "" end return (summary == "" and "-" or summary) end local my_diag_status = function(hl_end) local diag = vim.diagnostic local counts = diag.count(0) local signs = { "E", "W", "I", "H" } local hl_map = { [diag.severity.ERROR] = "DiagSLError", [diag.severity.WARN] = "DiagSLWarn", [diag.severity.INFO] = "DiagSLInfo", [diag.severity.HINT] = "DiagSLHint", } local result_str = vim.iter(pairs(counts)) :map( function(severity, count) return ("%%#%s#%s:%s"):format( hl_map[severity], signs[severity], count ) end ) :join(" ") if result_str:len() > 0 then result_str = result_str .. "%##%#" .. hl_end .. "#" end return result_str end local section_diagnostics = function() if _G.MiniStatusline.is_truncated(75) then return "" end if package.loaded["vim.diagnostic"] and #vim.diagnostic.count() ~= 0 then return my_diag_status("SLDev") end return "" end vim.schedule(function() local statusline = require("mini.statusline") statusline.setup({ content = { active = function() local git = section_git() local diff = section_diff() local diagnostics = section_diagnostics() local lsp = statusline.section_lsp({ trunc_width = 75 }) local filename = section_filename() local fileinfo = vim.bo.filetype local location = "%-6.(%l,%c%V%) %P" -- "%{% &ruler ? ( &rulerformat == '' ? '' : &rulerformat ) : '' %}" return statusline.combine_groups({ { hl = "SLFilename", strings = { filename } }, "%=", -- End left alignment { hl = "SLDev", strings = { git, diff, diagnostics, lsp } }, "%<", -- Mark general truncate point { hl = "SLFileInfo", strings = { fileinfo } }, { hl = "SLLocation", strings = { location } }, }) end, inactive = nil, }, use_icons = true, }) end)