Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4275967e0a | ||
|
|
ca015f90f9 | ||
|
|
10ef727e6f | ||
|
|
1356ec1860 |
@@ -0,0 +1,2 @@
|
|||||||
|
tmux/.config/tmux/plugins
|
||||||
|
.DS_Store
|
||||||
Vendored
BIN
Binary file not shown.
@@ -3,16 +3,16 @@ font-family = "JetBrainsMono Nerd Font Medium"
|
|||||||
font-thicken = true
|
font-thicken = true
|
||||||
font-size = 14
|
font-size = 14
|
||||||
|
|
||||||
|
scrollback-limit = 10000
|
||||||
macos-titlebar-style = transparent
|
macos-titlebar-style = transparent
|
||||||
macos-titlebar-proxy-icon = hidden
|
macos-titlebar-proxy-icon = hidden
|
||||||
title = " "
|
title = " "
|
||||||
background-opacity = 0.92
|
background-opacity = 0.90
|
||||||
background-blur = 64
|
background-blur = 64
|
||||||
confirm-close-surface = false
|
confirm-close-surface = false
|
||||||
window-padding-x = 15
|
window-padding-x = 15
|
||||||
window-padding-y = 15
|
|
||||||
mouse-hide-while-typing = true
|
mouse-hide-while-typing = true
|
||||||
adjust-cell-height = 5%
|
adjust-cell-height = 5%
|
||||||
adjust-cell-width = -5%
|
adjust-cell-width = -5%
|
||||||
alpha-blending = linear-corrected
|
alpha-blending = linear-corrected
|
||||||
mouse-hide-while-typing = true
|
copy-on-select = true
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -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,113 @@
|
|||||||
local function derive_hl(name, opts)
|
local ok, D = pcall(require, 'nvim-web-devicons')
|
||||||
local base = opts.base and vim.api.nvim_get_hl(0, { name = opts.base })
|
local a, S = vim.api, vim.diagnostic.severity
|
||||||
or {}
|
local now = (vim.uv or vim.loop).now
|
||||||
local fg = opts.fg and vim.api.nvim_get_hl(0, { name = opts.fg }) or {}
|
local C = a.nvim_get_current_buf
|
||||||
local bg = opts.bg and vim.api.nvim_get_hl(0, { name = opts.bg }) or {}
|
local R = function()
|
||||||
vim.api.nvim_set_hl(
|
vim.cmd.redrawstatus()
|
||||||
0,
|
end -- absorb autocmd ev (.file etc.)
|
||||||
name,
|
local M = '%m%r %='
|
||||||
{ fg = fg.fg or base.fg, bg = bg.bg or base.bg, bold = opts.bold }
|
local LOAD = '%#DiagnosticInfo#'
|
||||||
)
|
local T, JOB = {}, nil
|
||||||
end
|
local IV = vim.g.statusline_prog_interval or 750 -- ms cap between progress redraws
|
||||||
|
local LAST = 0
|
||||||
local function setup_statusline_highlights()
|
local function snap(bb)
|
||||||
local st = vim.api.nvim_get_hl(0, { name = 'StatusLine' })
|
local nm = ' %F' -- native tail: handles [No Name] and escaping in C
|
||||||
for name, link in pairs({
|
if ok then
|
||||||
Normal = 'Type',
|
local i, hl = D.get_icon(a.nvim_buf_get_name(bb), nil, { default = true })
|
||||||
Insert = 'String',
|
if i then
|
||||||
Visual = 'Statement',
|
nm = ' %#' .. hl .. '#' .. i .. ' %*%F'
|
||||||
Command = 'PreProc',
|
end
|
||||||
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 }
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
local x = vim.diagnostic.count(bb)
|
||||||
derive_hl('StatusGit', { base = 'CursorLine', fg = 'Normal' })
|
local e, w, h = x[S.ERROR] or 0, x[S.WARN] or 0, x[S.HINT] or 0
|
||||||
derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' })
|
local dg = ''
|
||||||
derive_hl(
|
if e + w + h > 0 then
|
||||||
'StatusLspWorking',
|
dg = (e > 0 and ('%#DiagnosticError#E' .. e .. '%* ') or '')
|
||||||
{ base = 'StatusLine', fg = 'DiagnosticInfo' }
|
.. (w > 0 and ('%#DiagnosticWarn#W' .. w .. '%* ') or '')
|
||||||
)
|
.. (h > 0 and ('%#DiagnosticHint#H' .. h .. '%* ') or '')
|
||||||
derive_hl('StatusLspReady', { base = 'StatusLine', fg = 'Constant' })
|
end
|
||||||
derive_hl('StatusLspNone', { base = 'StatusLine', fg = 'NonText' })
|
local rd, cs = '', vim.lsp.get_clients({ bufnr = bb })
|
||||||
derive_hl(
|
if #cs > 0 then
|
||||||
'StatusDiagError',
|
local nm2 = {}
|
||||||
{ base = 'StatusLine', fg = 'DiagnosticError' }
|
for i = 1, #cs do
|
||||||
)
|
nm2[i] = cs[i].name
|
||||||
derive_hl('StatusDiagWarn', { base = 'StatusLine', fg = 'DiagnosticWarn' })
|
end
|
||||||
derive_hl('StatusDiagHint', { base = 'StatusLine', fg = 'DiagnosticHint' })
|
rd = ' ' .. table.concat(nm2, '/') .. ' '
|
||||||
derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' })
|
end
|
||||||
derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'DiagnosticOk' })
|
return nm .. M .. dg, rd
|
||||||
derive_hl(
|
|
||||||
'StatusGitRemoved',
|
|
||||||
{ base = 'StatusLine', fg = 'DiagnosticError' }
|
|
||||||
)
|
|
||||||
derive_hl('StatusRecording', { base = 'StatusLine', fg = 'WarningMsg' })
|
|
||||||
end
|
end
|
||||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
local function touch(bb, redraw)
|
||||||
callback = setup_statusline_highlights,
|
local v = vim.b[bb] -- per-buffer cache; nvim frees b: vars on unload
|
||||||
})
|
if v then
|
||||||
setup_statusline_highlights()
|
v.d = true
|
||||||
|
end
|
||||||
local modes = {
|
if redraw then
|
||||||
n = { ' NORM ', 'StatusModeNormal' },
|
R()
|
||||||
i = { ' INS ', 'StatusModeInsert' },
|
end
|
||||||
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
|
end
|
||||||
|
local function SYNC(force) -- refresh JOB; redraw only when it changed and (force or gate open)
|
||||||
local redraw_scheduled = false
|
local prev = JOB
|
||||||
local function schedule_redraw()
|
JOB = nil
|
||||||
if redraw_scheduled then
|
for _, t in pairs(T) do
|
||||||
|
for _, m in pairs(t) do
|
||||||
|
JOB = m
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if JOB then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if JOB ~= prev and (force or now() - LAST >= IV) then
|
||||||
|
LAST = now()
|
||||||
|
R()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local G = a.nvim_create_augroup('STL5', { clear = true })
|
||||||
|
local function au(ev, cb)
|
||||||
|
a.nvim_create_autocmd(ev, { group = G, callback = cb })
|
||||||
|
end
|
||||||
|
au({ 'BufEnter', 'BufFilePost' }, function(e)
|
||||||
|
touch(e.buf, true)
|
||||||
|
end)
|
||||||
|
au('DiagnosticChanged', function(e)
|
||||||
|
touch(e.buf, e.buf == C())
|
||||||
|
end)
|
||||||
|
au({ 'LspAttach', 'LspDetach' }, function(e)
|
||||||
|
if e.event == 'LspDetach' then
|
||||||
|
T[e.data.client_id] = nil
|
||||||
|
SYNC(true)
|
||||||
|
end
|
||||||
|
touch(e.buf, true)
|
||||||
|
end)
|
||||||
|
au('LspProgress', function(e)
|
||||||
|
local v = e.data.params.value
|
||||||
|
if type(v) ~= 'table' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
redraw_scheduled = true
|
local id, tk = e.data.client_id, e.data.params.token or 'default'
|
||||||
vim.schedule(function()
|
T[id] = T[id] or {}
|
||||||
redraw_scheduled = false
|
if v.kind == 'end' or (v.kind == 'report' and v.percentage == 100) then
|
||||||
vim.cmd.redrawstatus()
|
T[id][tk] = nil
|
||||||
end)
|
SYNC(true) -- clear immediately, don't gate
|
||||||
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 .. '%*'
|
|
||||||
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
|
|
||||||
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 })
|
|
||||||
if #clients == 0 then
|
|
||||||
state, vim.b[buf].lsp_name = 'none', ''
|
|
||||||
else
|
else
|
||||||
local names = {}
|
local m = (v.title and v.title ~= '' and v.title) or v.message or 'Loading...'
|
||||||
for _, c in ipairs(clients) do
|
if v.title and v.message and v.message ~= '' then
|
||||||
names[#names + 1] = c.name
|
m = v.title .. ' ' .. v.message
|
||||||
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
|
||||||
vim.b[buf].lsp_name = table.concat(names, '/')
|
T[id][tk] = m
|
||||||
|
SYNC() -- gated: at most one redraw per IV ms
|
||||||
end
|
end
|
||||||
if vim.b[buf].lsp_state == state then
|
end)
|
||||||
return
|
au('ColorScheme', R)
|
||||||
|
au('FocusGained', R)
|
||||||
|
local function Status()
|
||||||
|
local v = vim.b
|
||||||
|
if not v.h or v.d then
|
||||||
|
v.h, v.r = snap(C())
|
||||||
|
v.stl = v.h .. v.r
|
||||||
|
v.d = nil
|
||||||
end
|
end
|
||||||
vim.b[buf].lsp_state = state
|
return JOB and (v.h .. LOAD .. JOB .. '%* ') or v.stl
|
||||||
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
|
||||||
|
_G.Status = Status
|
||||||
vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach' }, {
|
vim.opt.statusline = '%!v:lua.Status()'
|
||||||
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
|
|
||||||
end
|
|
||||||
refresh_lsp(ev.buf)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspProgress', {
|
|
||||||
callback = function(ev)
|
|
||||||
local cid = ev.data.client_id
|
|
||||||
local p = active_progress[cid] or { tokens = {} }
|
|
||||||
active_progress[cid] = p
|
|
||||||
|
|
||||||
if p.is_starting then
|
|
||||||
p.is_starting = nil
|
|
||||||
p.timer_id = (p.timer_id or 0) + 1 -- Invalidate pending start timer safely
|
|
||||||
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'
|
|
||||||
|
|
||||||
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)
|
|
||||||
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()
|
|
||||||
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 '')
|
|
||||||
.. ' %#StatusLineNC# %l:%-2c '
|
|
||||||
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
|
|
||||||
|
|
||||||
return md[1]
|
|
||||||
.. (b.status_left or '')
|
|
||||||
.. '%='
|
|
||||||
.. (b.status_right or '')
|
|
||||||
.. '%#StatusCursor# %l:%-2c %#'
|
|
||||||
.. md[2]
|
|
||||||
.. '# %p%% %*'
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.o.statusline = '%!v:lua.__statusline()'
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
column_width = 80
|
column_width = 120
|
||||||
line_endings = "Unix"
|
line_endings = "Unix"
|
||||||
indent_type = "Tabs"
|
indent_type = "Tabs"
|
||||||
indent_width = 4
|
indent_width = 2
|
||||||
quote_style = "AutoPreferSingle"
|
quote_style = "AutoPreferSingle"
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+21
-23
@@ -2,41 +2,39 @@ unbind M-,
|
|||||||
set -g prefix C-Space
|
set -g prefix C-Space
|
||||||
bind C-Space send-prefix
|
bind C-Space send-prefix
|
||||||
|
|
||||||
|
set -g default-shell $SHELL
|
||||||
|
set -s escape-time 0
|
||||||
set -g focus-events on
|
set -g focus-events on
|
||||||
|
set -g set-clipboard on
|
||||||
|
set -g detach-on-destroy off
|
||||||
|
|
||||||
set -ga terminal-features ',xterm-ghostty:RGB'
|
set -ga terminal-features ',xterm-ghostty:RGB'
|
||||||
set -as terminal-overrides ',xterm-ghostty:Tc'
|
set -as terminal-overrides ',xterm-ghostty:Tc'
|
||||||
set-option -g default-shell $SHELL
|
|
||||||
|
|
||||||
set -g status-position top
|
|
||||||
set -g status-justify left
|
|
||||||
set -g status-style 'bg=default' # Completely transparent container
|
|
||||||
|
|
||||||
set -g status-left-length 100
|
|
||||||
set -g status-left "#[fg=#090E13,bg=colour6,bold] #S "
|
|
||||||
|
|
||||||
set -g status-right ""
|
|
||||||
|
|
||||||
set -g window-status-current-format "#[fg=colour1,bg=default] #F#I:#W "
|
|
||||||
set -g window-status-format "#[fg=colour7,bg=default] #I:#W "
|
|
||||||
|
|
||||||
set -g message-style 'fg=colour3 bg=default bold'
|
|
||||||
|
|
||||||
set -g base-index 1
|
set -g base-index 1
|
||||||
set -g pane-base-index 1
|
set -g pane-base-index 1
|
||||||
set -g detach-on-destroy off
|
|
||||||
set -g renumber-windows on
|
set -g renumber-windows on
|
||||||
set -g set-clipboard on
|
|
||||||
set -s escape-time 0
|
set -g status off
|
||||||
set -g status-position top
|
set -g status-position top
|
||||||
|
set -g status-justify centre
|
||||||
|
set -g status-style bg=default
|
||||||
|
|
||||||
|
set -g status-left-length 40
|
||||||
|
set -g status-left "#{?client_prefix,#[fg=colour234]#[bg=colour6]#[bold] #S #[bg=default]#[nobold],#[fg=color242]#[bg=default]#S }"
|
||||||
|
set -g status-right ""
|
||||||
|
|
||||||
|
set -g window-status-separator " "
|
||||||
|
set -g window-status-format "#[fg=color242]#I:#W"
|
||||||
|
set -g window-status-current-format "#[fg=colour3 bold]#I:#W"
|
||||||
|
|
||||||
|
set -g message-style 'fg=colour3 bg=default bold'
|
||||||
|
|
||||||
bind-key h previous-window
|
bind-key h previous-window
|
||||||
bind-key l next-window
|
bind-key l next-window
|
||||||
bind -r v run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
|
||||||
bind-key z resize-pane -Z
|
bind-key z resize-pane -Z
|
||||||
bind -n C-h select-pane -L
|
bind-key b set-option -g status
|
||||||
bind -n C-j select-pane -D
|
bind -r v run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
||||||
bind -n C-k select-pane -U
|
|
||||||
bind -n C-l select-pane -R
|
|
||||||
bind -n C-S-h resize-pane -L 5
|
bind -n C-S-h resize-pane -L 5
|
||||||
bind -n C-S-j resize-pane -D 5
|
bind -n C-S-j resize-pane -D 5
|
||||||
bind -n C-S-k resize-pane -U 5
|
bind -n C-S-k resize-pane -U 5
|
||||||
|
|||||||
Reference in New Issue
Block a user