REFACTOR: Minimized bar even more

This commit is contained in:
2026-10-10 00:59:03 -04:00
parent 5e8d29a82b
commit 1356ec1860
8 changed files with 264 additions and 389 deletions
@@ -51,4 +51,4 @@ vim.keymap.set('n', '<leader>xx', ':Trouble diagnostics toggle<cr>')
vim.keymap.set('n', '<leader>zz', function() vim.keymap.set('n', '<leader>zz', function()
Snacks.zen() Snacks.zen()
end) end)
vim.keymap.set('n', '<leader>mp', ':Vellum<cr>', { desc = 'Markdown preview' }) -- vim.keymap.set('n', '<leader>mp', ':Vellum<cr>', { desc = 'Markdown preview' })
@@ -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.cursorline = true -- enable cursorline
vim.opt.cursorlineopt = { 'screenline', 'number' } -- cursorline look vim.opt.cursorlineopt = { 'screenline', 'number' } -- cursorline look
vim.opt.foldmethod = 'indent' vim.opt.foldmethod = 'indent'
vim.opt.foldcolumn = '1' vim.opt.foldcolumn = '0'
vim.opt.foldenable = false vim.opt.foldenable = false
vim.opt.shortmess = 'aFI' -- abbreviates messages and prevents file name being echoed when opened vim.opt.shortmess = 'aFI' -- abbreviates messages and prevents file name being echoed when opened
vim.opt.ignorecase = false -- ignore cases when searching 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.smarttab = true -- make tab behaviour smarter
vim.opt.laststatus = 3 vim.opt.laststatus = 3
vim.opt.showmode = false vim.opt.showmode = false
vim.opt.cmdheight = 0 -- vim.opt.cmdheight = 0
vim.opt.smoothscroll = true vim.opt.smoothscroll = true
vim.opt.spell = true vim.opt.spell = true
vim.diagnostic.config({ vim.diagnostic.config({
@@ -4,10 +4,7 @@ require('DarthMooMancer.plugins.kanso')
require('DarthMooMancer.plugins.mini-nvim') require('DarthMooMancer.plugins.mini-nvim')
require('DarthMooMancer.plugins.polydev') require('DarthMooMancer.plugins.polydev')
require('DarthMooMancer.plugins.treesitter') require('DarthMooMancer.plugins.treesitter')
require('DarthMooMancer.plugins.incline')
require('DarthMooMancer.plugins.mason') require('DarthMooMancer.plugins.mason')
require('DarthMooMancer.plugins.noice')
require('DarthMooMancer.plugins.snacks') require('DarthMooMancer.plugins.snacks')
require('DarthMooMancer.plugins.trouble') require('DarthMooMancer.plugins.trouble')
require('DarthMooMancer.plugins.conform') require('DarthMooMancer.plugins.conform')
require('DarthMooMancer.plugins.vellum')
@@ -22,14 +22,52 @@ require('incline').setup({
padding = 0, padding = 0,
margin = { horizontal = 0, vertical = 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) 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 = local filename =
vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t') vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
if filename == '' then if filename == '' then
filename = '[No Name]' filename = '[No Name]'
end end
local ft_icon, ft_color = devicons.get_icon_color(filename) local ft_icon, ft_color = devicons.get_icon_color(filename)
local modified = vim.bo[props.buf].modified local modified = vim.bo[props.buf].modified
local res = { local res = {
ft_icon and { ft_icon and {
' ', ' ',
@@ -42,6 +80,7 @@ require('incline').setup({
{ filename, gui = modified and 'bold,italic' or 'bold' }, { filename, gui = modified and 'bold,italic' or 'bold' },
guibg = 'none', guibg = 'none',
} }
if props.focused then if props.focused then
for _, item in ipairs(navic.get_data(props.buf) or {}) do for _, item in ipairs(navic.get_data(props.buf) or {}) do
table.insert(res, { table.insert(res, {
@@ -51,6 +90,7 @@ require('incline').setup({
}) })
end end
end end
table.insert(res, ' ') table.insert(res, ' ')
return res return res
end, end,
@@ -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
})
@@ -6,6 +6,28 @@ require('snacks').setup({
}, },
animate = { enabled = true }, animate = { enabled = true },
input = { 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 = { picker = {
enabled = true, enabled = true,
prompt = '', prompt = '',
@@ -29,7 +51,7 @@ require('snacks').setup({
toggles = { toggles = {
dim = false, dim = false,
diagnostics = true, diagnostics = true,
inlay_hints = true, inlay_hints = false,
}, },
}, },
}) })
@@ -1,416 +1,203 @@
local function derive_hl(name, opts) local has_devicons, devicons = pcall(require, 'nvim-web-devicons')
local base = opts.base and vim.api.nvim_get_hl(0, { name = opts.base }) local uv, api, b = vim.uv or vim.loop, vim.api, vim.b
or {} local SEV = vim.diagnostic.severity
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 {} local function setup_highlights()
vim.api.nvim_set_hl( local bg = api.nvim_get_hl(0, { name = 'StatusLine' }).bg or 'none'
0,
name, local function set(name, link, bold)
{ fg = fg.fg or base.fg, bg = bg.bg or base.bg, bold = opts.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 end
local function setup_statusline_highlights() set('StatusLineFilename', 'Normal', true)
local st = vim.api.nvim_get_hl(0, { name = 'StatusLine' }) set('StatusLineMod', 'WarningMsg', true)
for name, link in pairs({ set('StatusLineRO', 'ErrorMsg', true)
Normal = 'Type', set('StatusDiagError', 'DiagnosticError', true)
Insert = 'String', set('StatusDiagWarn', 'DiagnosticWarn', false)
Visual = 'Statement', set('StatusDiagHint', 'DiagnosticHint', false)
Command = 'PreProc', set('StatusLspSpinner', 'DiagnosticWarn', true)
Replace = 'WarningMsg', set('StatusLspLoading', 'DiagnosticInfo', false)
Terminal = 'Special', set('StatusLspReady', 'Comment', false)
}) 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 }
)
end end
derive_hl('StatusGit', { base = 'CursorLine', fg = 'Normal' }) api.nvim_create_autocmd({ 'ColorScheme', 'FocusGained', 'VimEnter' }, {
derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' }) callback = function()
derive_hl( setup_highlights()
'StatusLspWorking', vim.cmd('redrawstatus')
{ base = 'StatusLine', fg = 'DiagnosticInfo' } end,
)
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() setup_highlights()
local modes = { local function update_file_info(buf)
n = { ' NORM ', 'StatusModeNormal' }, local path = api.nvim_buf_get_name(buf)
i = { ' INS ', 'StatusModeInsert' }, if path == '' then
v = { ' VIS ', 'StatusModeVisual' }, b[buf].stl_file_info = ' %#StatusLineFilename#[No Name]%*'
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 return
end end
redraw_scheduled = true
vim.schedule(function()
redraw_scheduled = false
vim.cmd.redrawstatus()
end)
end
local function refresh_status(buf) local fname = path:match('([^/\\]+)$') or path
local b = vim.b[buf] local icon = ''
local l, r = '', '' if has_devicons then
local ic, hl = devicons.get_icon(
if b.git_branch and b.git_branch ~= '' then fname,
l = l .. '%#StatusGit# ' .. b.git_branch .. ' %*' path:match('%.([^./\\]+)$'),
end { default = true }
if b.git_diff then )
if b.git_diff.added > 0 then if ic then
l = l .. '%#StatusGitAdded# +' .. b.git_diff.added .. '%*' icon = '%#' .. hl .. '#' .. ic .. ' %*'
end
if b.git_diff.removed > 0 then
l = l .. '%#StatusGitRemoved# -' .. b.git_diff.removed .. '%*'
end end
end end
if b.recording then b[buf].stl_file_info = ' '
r = r .. '%#StatusRecording# ' .. b.recording .. ' %*' .. icon
end .. '%#StatusLineFilename#'
if b.diag_str then .. fname
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 end
b.status_left, b.status_right = l, r local function update_lsp_clients(buf)
end local clients = vim.lsp.get_clients({ bufnr = buf })
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 })
if #clients == 0 then if #clients == 0 then
state, vim.b[buf].lsp_name = 'none', '' b[buf].stl_lsp_ready = ''
else return
end
local names = {} local names = {}
for _, c in ipairs(clients) do for i = 1, #clients do
names[#names + 1] = c.name names[i] = clients[i].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
end b[buf].stl_lsp_ready = '%#StatusLspReady#󰄭 '
vim.b[buf].lsp_name = table.concat(names, '/') .. table.concat(names, '/')
end .. '%* '
if vim.b[buf].lsp_state == state then
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()
end end
vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach' }, { local active_tokens = {}
callback = function(ev) local spinner_frames =
local cid = ev.data.client_id { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' }
if ev.event == 'LspAttach' then local current_job, spinner_timer = nil, nil
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
end
refresh_lsp(ev.buf)
end,
})
vim.api.nvim_create_autocmd('LspProgress', { local function sync_spinner()
callback = function(ev) current_job = nil
local cid = ev.data.client_id for _, tokens in pairs(active_tokens) do
local p = active_progress[cid] or { tokens = {} } for _, msg in pairs(tokens) do
active_progress[cid] = p current_job = msg
break
if p.is_starting then end
p.is_starting = nil if current_job then
p.timer_id = (p.timer_id or 0) + 1 -- Invalidate pending start timer safely break
end
end end
local val = type(ev.data.params.value) == 'table' if current_job and not spinner_timer then
and ev.data.params.value spinner_timer = uv.new_timer()
or {} spinner_timer:start(
local kind = val.kind or ev.match 0,
local token = ev.data.params.token or 'fallback' 100,
vim.schedule_wrap(function()
if kind == 'begin' or (kind == 'report' and val.percentage ~= 100) then if current_job then
p.tokens[token] = true vim.cmd('redrawstatus')
elseif elseif spinner_timer then
kind == 'end' or (kind == 'report' and val.percentage == 100) spinner_timer:stop()
then spinner_timer:close()
p.tokens[token] = nil spinner_timer = nil
end 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)
) )
elseif not current_job and spinner_timer then
spinner_timer:stop()
spinner_timer:close()
spinner_timer = nil
vim.cmd('redrawstatus')
end
end end
local function refresh_diff(buf, force) local group = api.nvim_create_augroup('MinimalStatusline', { clear = true })
local file = vim.api.nvim_buf_get_name(buf)
if file == '' or vim.bo[buf].buftype ~= '' then api.nvim_create_autocmd({ 'BufEnter', 'BufFilePost' }, {
vim.b[buf].git_diff = nil group = group,
callback = function(ev)
update_file_info(ev.buf)
update_lsp_clients(ev.buf)
end,
})
api.nvim_create_autocmd('DiagnosticChanged', {
group = group,
callback = function(ev)
if ev.buf == api.nvim_get_current_buf() then
vim.cmd('redrawstatus')
end
end,
})
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 return
end end
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 if
not force val.kind == 'end'
and vim.b[buf].git_diff_fetched or (val.kind == 'report' and val.percentage == 100)
and not vim.bo[buf].modified
then then
return active_tokens[client_id][token] = nil
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 else
local added, removed = out.stdout:match('(%d+)%s+(%d+)') local msg = (val.title and val.title ~= '' and val.title)
if added and removed then or val.message
vim.b[buf].git_diff = { or 'Loading...'
added = tonumber(added) or 0, if val.title and val.message and val.message ~= '' then
removed = tonumber(removed) or 0, msg = val.title .. ' ' .. val.message
}
else
vim.b[buf].git_diff = nil
end end
end active_tokens[client_id][token] = msg
refresh_status(buf)
schedule_redraw()
end)
)
end end
local function refresh_diag(buf) sync_spinner()
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, end,
}) })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNewFile' }, { function MinimalStatusline()
group = grp, local cur_buf = api.nvim_get_current_buf()
callback = function(ev) local vars = b[cur_buf]
if vim.bo[ev.buf].buftype == '' then
refresh_branch(ev.buf) local c = vim.diagnostic.count(cur_buf)
refresh_diff(ev.buf, false) 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 end
refresh_lsp(ev.buf)
refresh_diag(ev.buf)
end,
})
vim.api.nvim_create_autocmd('FocusGained', { local right = current_job
group = grp, and ('%#StatusLspSpinner#' .. spinner_frames[(math.floor(
callback = function() uv.now() / 100
local buf = vim.api.nvim_get_current_buf() ) % 10) + 1] .. '%* %#StatusLspLoading#' .. current_job .. '%* ')
if vim.bo[buf].buftype == '' then or (vars.stl_lsp_ready or '')
refresh_branch(buf)
end
end,
})
vim.api.nvim_create_autocmd('BufWritePost', { return (vars.stl_file_info or '')
group = grp, .. '%#StatusLineMod#%m%*%#StatusLineRO#%r%* %='
callback = function(ev) .. diags
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()
else
vim.b[ev.buf].recording = nil
end
refresh_status(ev.buf)
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]
if not is_active then
return '%#StatusLineNC# '
.. (b.status_left or '')
.. '%=' .. '%='
.. (b.status_right or '') .. right
.. ' %#StatusLineNC# %l:%-2c '
end end
local m = current_mode vim.opt.laststatus = 3
local key = (m == '\22' or m == '\19') and m or m:sub(1, 1) vim.opt.statusline = '%!v:lua.MinimalStatusline()'
local md = mode_statusline[key] or mode_statusline.default
return md[1]
.. (b.status_left or '')
.. '%='
.. (b.status_right or '')
.. '%#StatusCursor# %l:%-2c %#'
.. md[2]
.. '# %p%% %*'
end
vim.o.statusline = '%!v:lua.__statusline()'
+4
View File
@@ -74,6 +74,10 @@
"rev": "2b30e36fade3272081f7166bc0ec614b0b7da1c9", "rev": "2b30e36fade3272081f7166bc0ec614b0b7da1c9",
"src": "https://git.moomancer.xyz/DarthMooMancer/polydev.git" "src": "https://git.moomancer.xyz/DarthMooMancer/polydev.git"
}, },
"smear-cursor.nvim": {
"rev": "f6cb57c342268177f719acc3968b9d8de3ecc969",
"src": "https://github.com/sphamba/smear-cursor.nvim"
},
"snacks.nvim": { "snacks.nvim": {
"rev": "882c996cf28183f4d63640de0b4c02ec886d01f2", "rev": "882c996cf28183f4d63640de0b4c02ec886d01f2",
"src": "https://github.com/folke/snacks.nvim" "src": "https://github.com/folke/snacks.nvim"