From 1356ec18605fb75f034c0b571cde83329fb2a3ac Mon Sep 17 00:00:00 2001 From: Andrew Haynes Date: Sat, 10 Oct 2026 00:59:03 -0400 Subject: [PATCH] REFACTOR: Minimized bar even more --- .../nvim/lua/DarthMooMancer/keymaps.lua | 2 +- nvim/.config/nvim/lua/DarthMooMancer/opts.lua | 4 +- .../nvim/lua/DarthMooMancer/plugins.lua | 3 - .../lua/DarthMooMancer/plugins/incline.lua | 40 ++ .../DarthMooMancer/plugins/smear-cursor.lua | 25 + .../lua/DarthMooMancer/plugins/snacks.lua | 24 +- .../nvim/lua/DarthMooMancer/statusline.lua | 551 ++++++------------ nvim/.config/nvim/nvim-pack-lock.json | 4 + 8 files changed, 264 insertions(+), 389 deletions(-) create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/plugins/smear-cursor.lua diff --git a/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua b/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua index 8d99c39..281c85c 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua @@ -51,4 +51,4 @@ vim.keymap.set('n', 'xx', ':Trouble diagnostics toggle') vim.keymap.set('n', 'zz', function() Snacks.zen() end) -vim.keymap.set('n', 'mp', ':Vellum', { desc = 'Markdown preview' }) +-- vim.keymap.set('n', 'mp', ':Vellum', { desc = 'Markdown preview' }) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/opts.lua b/nvim/.config/nvim/lua/DarthMooMancer/opts.lua index 44ed10b..b68073e 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/opts.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/opts.lua @@ -39,7 +39,7 @@ vim.opt.wrapscan = true -- begin search from top of the file when nothng is foun vim.opt.cursorline = true -- enable cursorline vim.opt.cursorlineopt = { 'screenline', 'number' } -- cursorline look vim.opt.foldmethod = 'indent' -vim.opt.foldcolumn = '1' +vim.opt.foldcolumn = '0' vim.opt.foldenable = false vim.opt.shortmess = 'aFI' -- abbreviates messages and prevents file name being echoed when opened vim.opt.ignorecase = false -- ignore cases when searching @@ -48,7 +48,7 @@ vim.opt.smartindent = false -- smarter indentation vim.opt.smarttab = true -- make tab behaviour smarter vim.opt.laststatus = 3 vim.opt.showmode = false -vim.opt.cmdheight = 0 +-- vim.opt.cmdheight = 0 vim.opt.smoothscroll = true vim.opt.spell = true vim.diagnostic.config({ diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua index 603c700..450b973 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua @@ -4,10 +4,7 @@ require('DarthMooMancer.plugins.kanso') require('DarthMooMancer.plugins.mini-nvim') require('DarthMooMancer.plugins.polydev') require('DarthMooMancer.plugins.treesitter') -require('DarthMooMancer.plugins.incline') require('DarthMooMancer.plugins.mason') -require('DarthMooMancer.plugins.noice') require('DarthMooMancer.plugins.snacks') require('DarthMooMancer.plugins.trouble') require('DarthMooMancer.plugins.conform') -require('DarthMooMancer.plugins.vellum') diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins/incline.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins/incline.lua index eca1e16..3034257 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/plugins/incline.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins/incline.lua @@ -22,14 +22,52 @@ require('incline').setup({ padding = 0, margin = { horizontal = 0, vertical = 0 }, }, + ignore = { + floating_wins = false, + wintypes = function(winid, wintype) + -- Check if snacks.zen is active anywhere in this tabpage + for _, w in ipairs(vim.api.nvim_tabpage_list_wins(0)) do + if vim.w[w].snacks_main then + return true -- Hide from ALL windows during Zen mode + end + end + + -- Default incline behavior (ignore non-normal windows) + return wintype ~= '' + end, + }, render = function(props) + -- 1. Count normal splits in the current tabpage + local wins = vim.api.nvim_tabpage_list_wins(0) + local normal_splits = 0 + + for _, win in ipairs(wins) do + -- Also check for snacks.zen here as an immediate guard + if vim.w[win].snacks_main then + return '' + end + + local config = vim.api.nvim_win_get_config(win) + if config.relative == '' then + normal_splits = normal_splits + 1 + end + end + + -- Hide if 2 or fewer normal splits are open (requires 3+) + if normal_splits <= 2 then + return '' + end + + -- 2. Build the visual statusline local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t') if filename == '' then filename = '[No Name]' end + local ft_icon, ft_color = devicons.get_icon_color(filename) local modified = vim.bo[props.buf].modified + local res = { ft_icon and { ' ', @@ -42,6 +80,7 @@ require('incline').setup({ { filename, gui = modified and 'bold,italic' or 'bold' }, guibg = 'none', } + if props.focused then for _, item in ipairs(navic.get_data(props.buf) or {}) do table.insert(res, { @@ -51,6 +90,7 @@ require('incline').setup({ }) end end + table.insert(res, ' ') return res end, diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins/smear-cursor.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins/smear-cursor.lua new file mode 100644 index 0000000..6d737a2 --- /dev/null +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins/smear-cursor.lua @@ -0,0 +1,25 @@ +vim.pack.add({ + 'https://github.com/sphamba/smear-cursor.nvim', +}) + +-- require('smear_cursor').setup({ +-- matrix_pixel_threshold = 0.5, +-- stiffness = 0.8, -- 0.6 [0, 1] +-- trailing_stiffness = 0.6, -- 0.45 [0, 1] +-- stiffness_insert_mode = 0.7, -- 0.5 [0, 1] +-- trailing_stiffness_insert_mode = 0.7, -- 0.5 [0, 1] +-- damping = 0.95, -- 0.85 [0, 1] +-- damping_insert_mode = 0.95, -- 0.9 [0, 1] +-- distance_stop_animating = 0.5, -- 0.1 > 0 +-- time_interval = 7, +-- }) +-- +require('smear_cursor').setup({ + stiffness = 0.8, -- 0.6 [0, 1] + trailing_stiffness = 0.6, -- 0.45 [0, 1] + stiffness_insert_mode = 0.7, -- 0.5 [0, 1] + trailing_stiffness_insert_mode = 0.7, -- 0.5 [0, 1] + damping = 0.95, -- 0.85 [0, 1] + damping_insert_mode = 0.95, -- 0.9 [0, 1] + distance_stop_animating = 0.5, -- 0.1 > 0 +}) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins/snacks.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins/snacks.lua index 7c83238..4bb1ba8 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/plugins/snacks.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins/snacks.lua @@ -6,6 +6,28 @@ require('snacks').setup({ }, animate = { enabled = true }, input = { enabled = true }, + -- scroll = { + -- enabled = true, + -- animate = { + -- -- duration = { step = 5, total = 120 }, + -- duration = { step = 2, total = 60 }, + -- easing = 'linear', + -- }, + -- -- faster animation when repeating scroll after delay + -- animate_repeat = { + -- -- delay = 100, -- delay in ms before using the repeat animation + -- delay = 40, -- delay in ms before using the repeat animation + -- -- duration = { step = 2, total = 40 }, + -- duration = { step = 1, total = 20 }, + -- easing = 'linear', + -- }, + -- -- what buffers to animate + -- filter = function(buf) + -- return vim.g.snacks_scroll ~= false + -- and vim.b[buf].snacks_scroll ~= false + -- and vim.bo[buf].buftype ~= 'terminal' + -- end, + -- }, picker = { enabled = true, prompt = '  ', @@ -29,7 +51,7 @@ require('snacks').setup({ toggles = { dim = false, diagnostics = true, - inlay_hints = true, + inlay_hints = false, }, }, }) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/statusline.lua b/nvim/.config/nvim/lua/DarthMooMancer/statusline.lua index 3dbb3c0..3808f5a 100644 --- a/nvim/.config/nvim/lua/DarthMooMancer/statusline.lua +++ b/nvim/.config/nvim/lua/DarthMooMancer/statusline.lua @@ -1,416 +1,203 @@ -local function derive_hl(name, opts) - local base = opts.base and vim.api.nvim_get_hl(0, { name = opts.base }) - or {} - local fg = opts.fg and vim.api.nvim_get_hl(0, { name = opts.fg }) or {} - local bg = opts.bg and vim.api.nvim_get_hl(0, { name = opts.bg }) or {} - vim.api.nvim_set_hl( - 0, - name, - { fg = fg.fg or base.fg, bg = bg.bg or base.bg, bold = opts.bold } - ) +local has_devicons, devicons = pcall(require, 'nvim-web-devicons') +local uv, api, b = vim.uv or vim.loop, vim.api, vim.b +local SEV = vim.diagnostic.severity + +local function setup_highlights() + local bg = api.nvim_get_hl(0, { name = 'StatusLine' }).bg or 'none' + + local function set(name, link, bold) + local hl = api.nvim_get_hl(0, { name = link, link = false }) + api.nvim_set_hl(0, name, { fg = hl.fg, bg = bg, bold = bold or false }) + end + + set('StatusLineFilename', 'Normal', true) + set('StatusLineMod', 'WarningMsg', true) + set('StatusLineRO', 'ErrorMsg', true) + set('StatusDiagError', 'DiagnosticError', true) + set('StatusDiagWarn', 'DiagnosticWarn', false) + set('StatusDiagHint', 'DiagnosticHint', false) + set('StatusLspSpinner', 'DiagnosticWarn', true) + set('StatusLspLoading', 'DiagnosticInfo', false) + set('StatusLspReady', 'Comment', false) end -local function setup_statusline_highlights() - local st = vim.api.nvim_get_hl(0, { name = 'StatusLine' }) - for name, link in pairs({ - Normal = 'Type', - Insert = 'String', - Visual = 'Statement', - Command = 'PreProc', - Replace = 'WarningMsg', - Terminal = 'Special', - }) do - local c = vim.api.nvim_get_hl(0, { name = link }) - vim.api.nvim_set_hl( - 0, - 'StatusMode' .. name, - { bg = c.fg, fg = st.bg or '#191724', bold = true } +api.nvim_create_autocmd({ 'ColorScheme', 'FocusGained', 'VimEnter' }, { + callback = function() + setup_highlights() + vim.cmd('redrawstatus') + end, +}) +setup_highlights() + +local function update_file_info(buf) + local path = api.nvim_buf_get_name(buf) + if path == '' then + b[buf].stl_file_info = ' %#StatusLineFilename#[No Name]%*' + return + end + + local fname = path:match('([^/\\]+)$') or path + local icon = '' + if has_devicons then + local ic, hl = devicons.get_icon( + fname, + path:match('%.([^./\\]+)$'), + { default = true } ) - end - - derive_hl('StatusGit', { base = 'CursorLine', fg = 'Normal' }) - derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' }) - derive_hl( - 'StatusLspWorking', - { base = 'StatusLine', fg = 'DiagnosticInfo' } - ) - derive_hl('StatusLspReady', { base = 'StatusLine', fg = 'Constant' }) - derive_hl('StatusLspNone', { base = 'StatusLine', fg = 'NonText' }) - derive_hl( - 'StatusDiagError', - { base = 'StatusLine', fg = 'DiagnosticError' } - ) - derive_hl('StatusDiagWarn', { base = 'StatusLine', fg = 'DiagnosticWarn' }) - derive_hl('StatusDiagHint', { base = 'StatusLine', fg = 'DiagnosticHint' }) - derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' }) - derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'DiagnosticOk' }) - derive_hl( - 'StatusGitRemoved', - { base = 'StatusLine', fg = 'DiagnosticError' } - ) - derive_hl('StatusRecording', { base = 'StatusLine', fg = 'WarningMsg' }) -end -vim.api.nvim_create_autocmd('ColorScheme', { - callback = setup_statusline_highlights, -}) -setup_statusline_highlights() - -local modes = { - n = { ' NORM ', 'StatusModeNormal' }, - i = { ' INS ', 'StatusModeInsert' }, - v = { ' VIS ', 'StatusModeVisual' }, - V = { ' V-LINE ', 'StatusModeVisual' }, - ['\22'] = { ' V-BLK ', 'StatusModeVisual' }, - ['\19'] = { ' V-BLK ', 'StatusModeVisual' }, - s = { ' VIS ', 'StatusModeVisual' }, - S = { ' V-LINE ', 'StatusModeVisual' }, - R = { ' REPL ', 'StatusModeReplace' }, - c = { ' CMD ', 'StatusModeCommand' }, - r = { ' PROMPT ', 'StatusModeCommand' }, - t = { ' TERM ', 'StatusModeTerminal' }, - ['!'] = { ' SHELL ', 'StatusModeCommand' }, -} - -local mode_statusline = - { default = { '%#StatusModeNormal# ?? %*', 'StatusModeNormal' } } -for k, v in pairs(modes) do - mode_statusline[k] = { '%#' .. v[2] .. '#' .. v[1] .. '%*', v[2] } -end - -local redraw_scheduled = false -local function schedule_redraw() - if redraw_scheduled then - return - end - redraw_scheduled = true - vim.schedule(function() - redraw_scheduled = false - vim.cmd.redrawstatus() - end) -end - -local function refresh_status(buf) - local b = vim.b[buf] - local l, r = '', '' - - if b.git_branch and b.git_branch ~= '' then - l = l .. '%#StatusGit# ' .. b.git_branch .. ' %*' - end - if b.git_diff then - if b.git_diff.added > 0 then - l = l .. '%#StatusGitAdded# +' .. b.git_diff.added .. '%*' - end - if b.git_diff.removed > 0 then - l = l .. '%#StatusGitRemoved# -' .. b.git_diff.removed .. '%*' + if ic then + icon = '%#' .. hl .. '#' .. ic .. ' %*' end end - if b.recording then - r = r .. '%#StatusRecording# ' .. b.recording .. ' %*' - end - if b.diag_str then - r = r .. b.diag_str - end - if b.lsp_icon and b.lsp_icon ~= '' then - r = r - .. '%#' - .. b.lsp_hl - .. '#' - .. b.lsp_icon - .. (b.lsp_name or '') - .. ' %*' - end - - b.status_left, b.status_right = l, r + b[buf].stl_file_info = ' ' + .. icon + .. '%#StatusLineFilename#' + .. fname + .. '%*' end -local lsp_states = { - none = { '', 'StatusLspNone' }, - starting = { '', 'StatusLspNone' }, - working = { ' 󰄬 ', 'StatusLspWorking' }, - ready = { ' 󰄭 ', 'StatusLspReady' }, -} -local active_progress = {} - -local function refresh_lsp(buf) - local state, clients = 'ready', vim.lsp.get_clients({ bufnr = buf }) +local function update_lsp_clients(buf) + local clients = vim.lsp.get_clients({ bufnr = buf }) if #clients == 0 then - state, vim.b[buf].lsp_name = 'none', '' - else - local names = {} - for _, c in ipairs(clients) do - names[#names + 1] = c.name - local p = active_progress[c.id] - if p and p.is_starting and state ~= 'working' then - state = 'starting' - elseif p and next(p.tokens) then - state = 'working' - end - end - vim.b[buf].lsp_name = table.concat(names, '/') - end - if vim.b[buf].lsp_state == state then + b[buf].stl_lsp_ready = '' return end - vim.b[buf].lsp_state = state - vim.b[buf].lsp_icon, vim.b[buf].lsp_hl = - lsp_states[state][1], lsp_states[state][2] - refresh_status(buf) - schedule_redraw() + + local names = {} + for i = 1, #clients do + names[i] = clients[i].name + end + b[buf].stl_lsp_ready = '%#StatusLspReady#󰄭 ' + .. table.concat(names, '/') + .. '%* ' end -vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach' }, { - callback = function(ev) - local cid = ev.data.client_id - if ev.event == 'LspAttach' then - local p = active_progress[cid] or { tokens = {} } - active_progress[cid] = p - if not p.is_starting and not next(p.tokens) then - p.is_starting = true - p.timer_id = (p.timer_id or 0) + 1 - local current_id = p.timer_id - vim.defer_fn(function() - local curr = active_progress[cid] - if - curr - and curr.is_starting - and curr.timer_id == current_id - then - curr.is_starting = nil - if vim.api.nvim_buf_is_valid(ev.buf) then - refresh_lsp(ev.buf) - end - end - end, 500) -- 500ms grace period to wait for LspProgress - end - elseif ev.event == 'LspDetach' then - active_progress[cid] = nil +local active_tokens = {} +local spinner_frames = + { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' } +local current_job, spinner_timer = nil, nil + +local function sync_spinner() + current_job = nil + for _, tokens in pairs(active_tokens) do + for _, msg in pairs(tokens) do + current_job = msg + break end - refresh_lsp(ev.buf) + if current_job then + break + end + end + + if current_job and not spinner_timer then + spinner_timer = uv.new_timer() + spinner_timer:start( + 0, + 100, + vim.schedule_wrap(function() + if current_job then + vim.cmd('redrawstatus') + elseif spinner_timer then + spinner_timer:stop() + spinner_timer:close() + spinner_timer = nil + end + end) + ) + elseif not current_job and spinner_timer then + spinner_timer:stop() + spinner_timer:close() + spinner_timer = nil + vim.cmd('redrawstatus') + end +end + +local group = api.nvim_create_augroup('MinimalStatusline', { clear = true }) + +api.nvim_create_autocmd({ 'BufEnter', 'BufFilePost' }, { + group = group, + callback = function(ev) + update_file_info(ev.buf) + update_lsp_clients(ev.buf) end, }) -vim.api.nvim_create_autocmd('LspProgress', { +api.nvim_create_autocmd('DiagnosticChanged', { + group = group, callback = function(ev) - local cid = ev.data.client_id - local p = active_progress[cid] or { tokens = {} } - active_progress[cid] = p + if ev.buf == api.nvim_get_current_buf() then + vim.cmd('redrawstatus') + end + end, +}) - if p.is_starting then - p.is_starting = nil - p.timer_id = (p.timer_id or 0) + 1 -- Invalidate pending start timer safely +api.nvim_create_autocmd({ 'LspAttach', 'LspDetach' }, { + group = group, + callback = function(ev) + if ev.event == 'LspDetach' then + active_tokens[ev.data.client_id] = nil + sync_spinner() + end + update_lsp_clients(ev.buf) + vim.cmd('redrawstatus') + end, +}) + +api.nvim_create_autocmd('LspProgress', { + group = group, + callback = function(ev) + local val = ev.data.params.value + if type(val) ~= 'table' then + return end - local val = type(ev.data.params.value) == 'table' - and ev.data.params.value - or {} - local kind = val.kind or ev.match - local token = ev.data.params.token or 'fallback' + local client_id = ev.data.client_id + local token = ev.data.params.token or 'default' + active_tokens[client_id] = active_tokens[client_id] or {} - if kind == 'begin' or (kind == 'report' and val.percentage ~= 100) then - p.tokens[token] = true - elseif - kind == 'end' or (kind == 'report' and val.percentage == 100) + if + val.kind == 'end' + or (val.kind == 'report' and val.percentage == 100) then - p.tokens[token] = nil - end - local client = vim.lsp.get_client_by_id(ev.data.client_id) - if client then - for _, win in ipairs(vim.api.nvim_list_wins()) do - local buf = vim.api.nvim_win_get_buf(win) - if client.attached_buffers[buf] then - refresh_lsp(buf) - end - end - end - end, -}) - -local BRANCH_ICON = ' ' -local branch_jobs = {} -local diff_jobs = {} -local git_root_cache = {} -local function get_git_root(buf, file) - local dir = vim.fs.dirname(file) - if git_root_cache[dir] ~= nil then - return git_root_cache[dir] - end - local root = vim.fs.root(buf, '.git') or dir - git_root_cache[dir] = root - return root -end - -local function refresh_branch(buf) - local file = vim.api.nvim_buf_get_name(buf) - if file == '' or vim.bo[buf].buftype ~= '' then - vim.b[buf].git_branch = '' - return - end - local cwd = get_git_root(buf, file) - - if branch_jobs[buf] then - branch_jobs[buf]:kill(9) - end - - branch_jobs[buf] = vim.system( - { 'git', 'branch', '--show-current' }, - { text = true, cwd = cwd }, - vim.schedule_wrap(function(out) - branch_jobs[buf] = nil - if not vim.api.nvim_buf_is_valid(buf) then - return - end - local branch = (out.code == 0 and out.stdout or ''):gsub('%s+', '') - vim.b[buf].git_branch = branch ~= '' and (BRANCH_ICON .. branch) - or '' - refresh_status(buf) - schedule_redraw() - end) - ) -end - -local function refresh_diff(buf, force) - local file = vim.api.nvim_buf_get_name(buf) - if file == '' or vim.bo[buf].buftype ~= '' then - vim.b[buf].git_diff = nil - return - end - if - not force - and vim.b[buf].git_diff_fetched - and not vim.bo[buf].modified - then - return - end - local cwd = get_git_root(buf, file) - - if diff_jobs[buf] then - diff_jobs[buf]:kill(9) - end - - diff_jobs[buf] = vim.system( - { 'git', 'diff', '--numstat', 'HEAD', '--', file }, - { text = true, cwd = cwd }, - vim.schedule_wrap(function(out) - diff_jobs[buf] = nil - if not vim.api.nvim_buf_is_valid(buf) then - return - end - vim.b[buf].git_diff_fetched = true - if out.code ~= 0 or out.stdout == '' then - vim.b[buf].git_diff = nil - else - local added, removed = out.stdout:match('(%d+)%s+(%d+)') - if added and removed then - vim.b[buf].git_diff = { - added = tonumber(added) or 0, - removed = tonumber(removed) or 0, - } - else - vim.b[buf].git_diff = nil - end - end - refresh_status(buf) - schedule_redraw() - end) - ) -end - -local function refresh_diag(buf) - local c, s = vim.diagnostic.count(buf), vim.diagnostic.severity - local e, w, h = c[s.ERROR] or 0, c[s.WARN] or 0, c[s.HINT] or 0 - vim.b[buf].diag_str = (e > 0 and '%#StatusDiagError# E' .. e .. ' %*' or '') - .. (w > 0 and '%#StatusDiagWarn# W' .. w .. ' %*' or '') - .. (h > 0 and '%#StatusDiagHint# H' .. h .. ' %*' or '') - refresh_status(buf) - schedule_redraw() -end - -local grp = vim.api.nvim_create_augroup('StatuslineEvents', { clear = true }) -local current_mode = 'n' - -vim.api.nvim_create_autocmd('ModeChanged', { - group = grp, - pattern = '*:*', - callback = function() - current_mode = vim.api.nvim_get_mode().mode - schedule_redraw() - end, -}) - -vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNewFile' }, { - group = grp, - callback = function(ev) - if vim.bo[ev.buf].buftype == '' then - refresh_branch(ev.buf) - refresh_diff(ev.buf, false) - end - refresh_lsp(ev.buf) - refresh_diag(ev.buf) - end, -}) - -vim.api.nvim_create_autocmd('FocusGained', { - group = grp, - callback = function() - local buf = vim.api.nvim_get_current_buf() - if vim.bo[buf].buftype == '' then - refresh_branch(buf) - end - end, -}) - -vim.api.nvim_create_autocmd('BufWritePost', { - group = grp, - callback = function(ev) - refresh_diff(ev.buf, true) - end, -}) - -vim.api.nvim_create_autocmd('DiagnosticChanged', { - group = grp, - callback = function(ev) - refresh_diag(ev.buf) - end, -}) - -vim.api.nvim_create_autocmd({ 'RecordingEnter', 'RecordingLeave' }, { - group = grp, - callback = function(ev) - if ev.event == 'RecordingEnter' then - vim.b[ev.buf].recording = 'Rec @' .. vim.fn.reg_recording() + active_tokens[client_id][token] = nil else - vim.b[ev.buf].recording = nil + local msg = (val.title and val.title ~= '' and val.title) + or val.message + or 'Loading...' + if val.title and val.message and val.message ~= '' then + msg = val.title .. ' ' .. val.message + end + active_tokens[client_id][token] = msg end - refresh_status(ev.buf) + + sync_spinner() end, }) -function _G.__statusline() - local current_win = vim.api.nvim_get_current_win() - local win_id = vim.g.statusline_winid or current_win - local is_active = win_id == current_win - local buf = vim.api.nvim_win_get_buf(win_id) - local b = vim.b[buf] +function MinimalStatusline() + local cur_buf = api.nvim_get_current_buf() + local vars = b[cur_buf] - if not is_active then - return '%#StatusLineNC# ' - .. (b.status_left or '') - .. '%=' - .. (b.status_right or '') - .. ' %#StatusLineNC# %l:%-2c ' + local c = vim.diagnostic.count(cur_buf) + local e, w, h = c[SEV.ERROR] or 0, c[SEV.WARN] or 0, c[SEV.HINT] or 0 + local diags = '' + if e > 0 or w > 0 or h > 0 then + diags = (e > 0 and ('%#StatusDiagError#E' .. e .. '%* ') or '') + .. (w > 0 and ('%#StatusDiagWarn#W' .. w .. '%* ') or '') + .. (h > 0 and ('%#StatusDiagHint#H' .. h .. '%*') or '') end - local m = current_mode - local key = (m == '\22' or m == '\19') and m or m:sub(1, 1) - local md = mode_statusline[key] or mode_statusline.default + local right = current_job + and ('%#StatusLspSpinner#' .. spinner_frames[(math.floor( + uv.now() / 100 + ) % 10) + 1] .. '%* %#StatusLspLoading#' .. current_job .. '%* ') + or (vars.stl_lsp_ready or '') - return md[1] - .. (b.status_left or '') + return (vars.stl_file_info or '') + .. '%#StatusLineMod#%m%*%#StatusLineRO#%r%* %=' + .. diags .. '%=' - .. (b.status_right or '') - .. '%#StatusCursor# %l:%-2c %#' - .. md[2] - .. '# %p%% %*' + .. right end -vim.o.statusline = '%!v:lua.__statusline()' +vim.opt.laststatus = 3 +vim.opt.statusline = '%!v:lua.MinimalStatusline()' diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json index 2ce23c5..2b66779 100644 --- a/nvim/.config/nvim/nvim-pack-lock.json +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -74,6 +74,10 @@ "rev": "2b30e36fade3272081f7166bc0ec614b0b7da1c9", "src": "https://git.moomancer.xyz/DarthMooMancer/polydev.git" }, + "smear-cursor.nvim": { + "rev": "f6cb57c342268177f719acc3968b9d8de3ecc969", + "src": "https://github.com/sphamba/smear-cursor.nvim" + }, "snacks.nvim": { "rev": "882c996cf28183f4d63640de0b4c02ec886d01f2", "src": "https://github.com/folke/snacks.nvim"