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-size = 14
|
||||
|
||||
scrollback-limit = 10000
|
||||
macos-titlebar-style = transparent
|
||||
macos-titlebar-proxy-icon = hidden
|
||||
title = " "
|
||||
background-opacity = 0.92
|
||||
background-opacity = 0.90
|
||||
background-blur = 64
|
||||
confirm-close-surface = false
|
||||
window-padding-x = 15
|
||||
window-padding-y = 15
|
||||
mouse-hide-while-typing = true
|
||||
adjust-cell-height = 5%
|
||||
adjust-cell-width = -5%
|
||||
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()
|
||||
Snacks.zen()
|
||||
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.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({
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 },
|
||||
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,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,416 +1,113 @@
|
||||
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 }
|
||||
)
|
||||
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 }
|
||||
)
|
||||
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
|
||||
local ok, D = pcall(require, 'nvim-web-devicons')
|
||||
local a, S = vim.api, vim.diagnostic.severity
|
||||
local now = (vim.uv or vim.loop).now
|
||||
local C = a.nvim_get_current_buf
|
||||
local R = function()
|
||||
vim.cmd.redrawstatus()
|
||||
end)
|
||||
end -- absorb autocmd ev (.file etc.)
|
||||
local M = '%m%r %='
|
||||
local LOAD = '%#DiagnosticInfo#'
|
||||
local T, JOB = {}, nil
|
||||
local IV = vim.g.statusline_prog_interval or 750 -- ms cap between progress redraws
|
||||
local LAST = 0
|
||||
local function snap(bb)
|
||||
local nm = ' %F' -- native tail: handles [No Name] and escaping in C
|
||||
if ok then
|
||||
local i, hl = D.get_icon(a.nvim_buf_get_name(bb), nil, { default = true })
|
||||
if i then
|
||||
nm = ' %#' .. hl .. '#' .. i .. ' %*%F'
|
||||
end
|
||||
end
|
||||
local x = vim.diagnostic.count(bb)
|
||||
local e, w, h = x[S.ERROR] or 0, x[S.WARN] or 0, x[S.HINT] or 0
|
||||
local dg = ''
|
||||
if e + w + h > 0 then
|
||||
dg = (e > 0 and ('%#DiagnosticError#E' .. e .. '%* ') or '')
|
||||
.. (w > 0 and ('%#DiagnosticWarn#W' .. w .. '%* ') or '')
|
||||
.. (h > 0 and ('%#DiagnosticHint#H' .. h .. '%* ') or '')
|
||||
end
|
||||
local rd, cs = '', vim.lsp.get_clients({ bufnr = bb })
|
||||
if #cs > 0 then
|
||||
local nm2 = {}
|
||||
for i = 1, #cs do
|
||||
nm2[i] = cs[i].name
|
||||
end
|
||||
rd = ' ' .. table.concat(nm2, '/') .. ' '
|
||||
end
|
||||
return nm .. M .. dg, rd
|
||||
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 .. ' %*'
|
||||
local function touch(bb, redraw)
|
||||
local v = vim.b[bb] -- per-buffer cache; nvim frees b: vars on unload
|
||||
if v then
|
||||
v.d = true
|
||||
end
|
||||
if b.git_diff then
|
||||
if b.git_diff.added > 0 then
|
||||
l = l .. '%#StatusGitAdded# +' .. b.git_diff.added .. '%*'
|
||||
if redraw then
|
||||
R()
|
||||
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', ''
|
||||
local function SYNC(force) -- refresh JOB; redraw only when it changed and (force or gate open)
|
||||
local prev = JOB
|
||||
JOB = nil
|
||||
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
|
||||
end
|
||||
local id, tk = e.data.client_id, e.data.params.token or 'default'
|
||||
T[id] = T[id] or {}
|
||||
if v.kind == 'end' or (v.kind == 'report' and v.percentage == 100) then
|
||||
T[id][tk] = nil
|
||||
SYNC(true) -- clear immediately, don't gate
|
||||
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'
|
||||
local m = (v.title and v.title ~= '' and v.title) or v.message or 'Loading...'
|
||||
if v.title and v.message and v.message ~= '' then
|
||||
m = v.title .. ' ' .. v.message
|
||||
end
|
||||
T[id][tk] = m
|
||||
SYNC() -- gated: at most one redraw per IV ms
|
||||
end
|
||||
vim.b[buf].lsp_name = table.concat(names, '/')
|
||||
end)
|
||||
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
|
||||
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()
|
||||
return JOB and (v.h .. LOAD .. JOB .. '%* ') or v.stl
|
||||
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
|
||||
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()'
|
||||
_G.Status = Status
|
||||
vim.opt.statusline = '%!v:lua.Status()'
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
column_width = 80
|
||||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Tabs"
|
||||
indent_width = 4
|
||||
indent_width = 2
|
||||
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
|
||||
bind C-Space send-prefix
|
||||
|
||||
set -g default-shell $SHELL
|
||||
set -s escape-time 0
|
||||
set -g focus-events on
|
||||
set -g set-clipboard on
|
||||
set -g detach-on-destroy off
|
||||
|
||||
set -ga terminal-features ',xterm-ghostty:RGB'
|
||||
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 pane-base-index 1
|
||||
set -g detach-on-destroy off
|
||||
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-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 l next-window
|
||||
bind -r v run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
||||
bind-key z resize-pane -Z
|
||||
bind -n C-h select-pane -L
|
||||
bind -n C-j select-pane -D
|
||||
bind -n C-k select-pane -U
|
||||
bind -n C-l select-pane -R
|
||||
bind-key b set-option -g status
|
||||
bind -r v run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
||||
bind -n C-S-h resize-pane -L 5
|
||||
bind -n C-S-j resize-pane -D 5
|
||||
bind -n C-S-k resize-pane -U 5
|
||||
|
||||
Reference in New Issue
Block a user