diff --git a/init.lua b/init.lua index 3a90985..026b989 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ -- All configuration lives in lua/config/ and lua/plugins/ -- Leader keys must be set before lazy loads any plugin -vim.g.mapleader = ' ' +vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.g.have_nerd_font = false @@ -16,8 +16,12 @@ require 'config.autocmds' local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or vim.loop).fs_stat(lazypath) then local out = vim.fn.system { - 'git', 'clone', '--filter=blob:none', '--branch=stable', - 'https://github.com/folke/lazy.nvim.git', lazypath, + 'git', + 'clone', + '--filter=blob:none', + '--branch=stable', + 'https://github.com/folke/lazy.nvim.git', + lazypath, } if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) @@ -28,23 +32,22 @@ vim.opt.rtp:prepend(lazypath) -- Load all plugin specs from lua/plugins/*.lua and lua/plugins/extras/*.lua require('lazy').setup({ { import = 'plugins' }, - { import = 'plugins.extras' }, }, { ui = { icons = vim.g.have_nerd_font and {} or { - cmd = 'โŒ˜', - config = '๐Ÿ› ', - event = '๐Ÿ“…', - ft = '๐Ÿ“‚', - init = 'โš™', - keys = '๐Ÿ—', - plugin = '๐Ÿ”Œ', + cmd = 'โŒ˜', + config = '๐Ÿ› ', + event = '๐Ÿ“…', + ft = '๐Ÿ“‚', + init = 'โš™', + keys = '๐Ÿ—', + plugin = '๐Ÿ”Œ', runtime = '๐Ÿ’ป', require = '๐ŸŒ™', - source = '๐Ÿ“„', - start = '๐Ÿš€', - task = '๐Ÿ“Œ', - lazy = '๐Ÿ’ค ', + source = '๐Ÿ“„', + start = '๐Ÿš€', + task = '๐Ÿ“Œ', + lazy = '๐Ÿ’ค ', }, }, }) diff --git a/lua/plugins/extras/ai.lua b/lua/plugins/ai.lua similarity index 96% rename from lua/plugins/extras/ai.lua rename to lua/plugins/ai.lua index 90a88f2..0f0ab62 100644 --- a/lua/plugins/extras/ai.lua +++ b/lua/plugins/ai.lua @@ -17,8 +17,8 @@ return { _99.setup { -- OpenCodeProvider is the default; matches the opencode environment logger = { - level = _99.DEBUG, - path = '/tmp/' .. basename .. '.99.debug', + level = _99.DEBUG, + path = '/tmp/' .. basename .. '.99.debug', print_on_error = true, }, -- tmp_dir must be inside CWD so opencode has write permission diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 66fdce2..c580597 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -8,66 +8,66 @@ -- โ”€โ”€ Shared accent colors โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ local accent = { - orange = '#EC5B2B', + orange = '#EC5B2B', orange_br = '#EE7948', - cyan = '#56b6c2', - red = '#e06c75', + cyan = '#56b6c2', + red = '#e06c75', } -- โ”€โ”€ Dark palette โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ local dark = { - bg = '#0a0a0a', - fg = '#eeeeee', - orange = accent.orange, + bg = '#0a0a0a', + fg = '#eeeeee', + orange = accent.orange, orange_br = accent.orange_br, - yellow = '#e5c07b', + yellow = '#e5c07b', yellow_br = '#FFF7F1', - blue = '#6ba1e6', - cyan = accent.cyan, - red = accent.red, - gray1 = '#1a1a1a', -- panel / float bg - gray2 = '#2a2a2a', -- prompt bg - gray3 = '#3a3a3a', -- borders / separators - gray4 = '#606060', -- comments / inactive - gray5 = '#888888', -- delimiters - sel_bg = accent.orange, - sel_fg = '#0a0a0a', - diff_add = '#0d1f2d', - diff_chg = '#1f1a0d', - diff_del = '#1f0d0d', - diff_txt = '#2a1a0a', - vt_err = '#1f0d0d', - vt_warn = '#1f1a0d', - vt_info = '#0d1020', - vt_hint = '#0d1a1a', + blue = '#6ba1e6', + cyan = accent.cyan, + red = accent.red, + gray1 = '#1a1a1a', -- panel / float bg + gray2 = '#2a2a2a', -- prompt bg + gray3 = '#3a3a3a', -- borders / separators + gray4 = '#606060', -- comments / inactive + gray5 = '#888888', -- delimiters + sel_bg = accent.orange, + sel_fg = '#0a0a0a', + diff_add = '#0d1f2d', + diff_chg = '#1f1a0d', + diff_del = '#1f0d0d', + diff_txt = '#2a1a0a', + vt_err = '#1f0d0d', + vt_warn = '#1f1a0d', + vt_info = '#0d1020', + vt_hint = '#0d1a1a', } -- โ”€โ”€ Light palette โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ local light = { - bg = '#ffffff', - fg = '#1a1a1a', - orange = '#D44A1A', -- slightly darker than accent for readability on white + bg = '#ffffff', + fg = '#1a1a1a', + orange = '#D44A1A', -- slightly darker than accent for readability on white orange_br = accent.orange, - yellow = '#b07800', + yellow = '#b07800', yellow_br = '#8a5c00', - blue = '#2d6fc4', - cyan = '#1a7a87', - red = '#c0334a', - gray1 = '#f5f0eb', -- panel / float bg (warm off-white) - gray2 = '#ede8e2', -- prompt bg - gray3 = '#d4cfc8', -- borders / separators - gray4 = '#999999', -- comments / inactive - gray5 = '#777777', -- delimiters - sel_bg = accent.orange, - sel_fg = '#ffffff', - diff_add = '#ddeeff', - diff_chg = '#fff3cc', - diff_del = '#ffd6d6', - diff_txt = '#ffe0b2', - vt_err = '#fde8e8', - vt_warn = '#fef9e0', - vt_info = '#e8f0fd', - vt_hint = '#e0f5f5', + blue = '#2d6fc4', + cyan = '#1a7a87', + red = '#c0334a', + gray1 = '#f5f0eb', -- panel / float bg (warm off-white) + gray2 = '#ede8e2', -- prompt bg + gray3 = '#d4cfc8', -- borders / separators + gray4 = '#999999', -- comments / inactive + gray5 = '#777777', -- delimiters + sel_bg = accent.orange, + sel_fg = '#ffffff', + diff_add = '#ddeeff', + diff_chg = '#fff3cc', + diff_del = '#ffd6d6', + diff_txt = '#ffe0b2', + vt_err = '#fde8e8', + vt_warn = '#fef9e0', + vt_info = '#e8f0fd', + vt_hint = '#e0f5f5', } -- โ”€โ”€ Highlight helper โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ @@ -80,260 +80,262 @@ local function apply(c, variant) local bg_mode = variant == 'light' and 'light' or 'dark' vim.o.background = bg_mode vim.cmd.highlight 'clear' - if vim.fn.exists 'syntax_on' == 1 then vim.cmd.syntax 'reset' end + if vim.fn.exists 'syntax_on' == 1 then + vim.cmd.syntax 'reset' + end vim.g.colors_name = 'orng' .. (variant == 'light' and '-light' or '') -- Editor chrome - hi('Normal', { fg = c.fg, bg = c.bg }) - hi('NormalFloat', { fg = c.fg, bg = c.gray1 }) - hi('NormalNC', { fg = c.fg, bg = c.bg }) - hi('FloatBorder', { fg = c.orange, bg = c.gray1 }) - hi('FloatTitle', { fg = c.orange_br, bg = c.gray1, bold = true }) - hi('ColorColumn', { bg = c.gray1 }) - hi('CursorLine', { bg = c.gray1 }) - hi('CursorLineNr', { fg = c.orange, bold = true }) - hi('LineNr', { fg = c.gray4 }) - hi('SignColumn', { fg = c.gray4, bg = c.bg }) - hi('Folded', { fg = c.gray4, bg = c.gray1 }) - hi('FoldColumn', { fg = c.gray4, bg = c.bg }) - hi('VertSplit', { fg = c.gray3 }) - hi('WinSeparator', { fg = c.gray3 }) - hi('EndOfBuffer', { fg = c.gray3 }) + hi('Normal', { fg = c.fg, bg = c.bg }) + hi('NormalFloat', { fg = c.fg, bg = c.gray1 }) + hi('NormalNC', { fg = c.fg, bg = c.bg }) + hi('FloatBorder', { fg = c.orange, bg = c.gray1 }) + hi('FloatTitle', { fg = c.orange_br, bg = c.gray1, bold = true }) + hi('ColorColumn', { bg = c.gray1 }) + hi('CursorLine', { bg = c.gray1 }) + hi('CursorLineNr', { fg = c.orange, bold = true }) + hi('LineNr', { fg = c.gray4 }) + hi('SignColumn', { fg = c.gray4, bg = c.bg }) + hi('Folded', { fg = c.gray4, bg = c.gray1 }) + hi('FoldColumn', { fg = c.gray4, bg = c.bg }) + hi('VertSplit', { fg = c.gray3 }) + hi('WinSeparator', { fg = c.gray3 }) + hi('EndOfBuffer', { fg = c.gray3 }) -- Cursor & selection - hi('Cursor', { fg = c.bg, bg = c.fg }) - hi('CursorIM', { fg = c.bg, bg = c.fg }) - hi('Visual', { fg = c.sel_fg, bg = c.sel_bg }) - hi('VisualNOS', { fg = c.sel_fg, bg = c.sel_bg }) + hi('Cursor', { fg = c.bg, bg = c.fg }) + hi('CursorIM', { fg = c.bg, bg = c.fg }) + hi('Visual', { fg = c.sel_fg, bg = c.sel_bg }) + hi('VisualNOS', { fg = c.sel_fg, bg = c.sel_bg }) -- Status / tab line - hi('StatusLine', { fg = c.fg, bg = c.gray2 }) - hi('StatusLineNC', { fg = c.gray4, bg = c.gray1 }) - hi('TabLine', { fg = c.gray4, bg = c.gray1 }) - hi('TabLineFill', { bg = c.gray1 }) - hi('TabLineSel', { fg = c.fg, bg = c.gray2, bold = true }) + hi('StatusLine', { fg = c.fg, bg = c.gray2 }) + hi('StatusLineNC', { fg = c.gray4, bg = c.gray1 }) + hi('TabLine', { fg = c.gray4, bg = c.gray1 }) + hi('TabLineFill', { bg = c.gray1 }) + hi('TabLineSel', { fg = c.fg, bg = c.gray2, bold = true }) -- Pmenu - hi('Pmenu', { fg = c.fg, bg = c.gray1 }) - hi('PmenuSel', { fg = c.sel_fg, bg = c.orange }) - hi('PmenuSbar', { bg = c.gray2 }) - hi('PmenuThumb', { bg = c.orange }) - hi('PmenuBorder', { fg = c.orange }) + hi('Pmenu', { fg = c.fg, bg = c.gray1 }) + hi('PmenuSel', { fg = c.sel_fg, bg = c.orange }) + hi('PmenuSbar', { bg = c.gray2 }) + hi('PmenuThumb', { bg = c.orange }) + hi('PmenuBorder', { fg = c.orange }) -- Search - hi('Search', { fg = c.bg, bg = c.yellow }) - hi('IncSearch', { fg = c.bg, bg = c.orange }) - hi('CurSearch', { fg = c.bg, bg = c.orange_br }) - hi('Substitute', { fg = c.bg, bg = c.orange }) + hi('Search', { fg = c.bg, bg = c.yellow }) + hi('IncSearch', { fg = c.bg, bg = c.orange }) + hi('CurSearch', { fg = c.bg, bg = c.orange_br }) + hi('Substitute', { fg = c.bg, bg = c.orange }) -- Messages - hi('ErrorMsg', { fg = c.red, bold = true }) - hi('WarningMsg', { fg = c.yellow }) - hi('ModeMsg', { fg = c.orange, bold = true }) - hi('MoreMsg', { fg = c.orange }) - hi('Question', { fg = c.blue }) + hi('ErrorMsg', { fg = c.red, bold = true }) + hi('WarningMsg', { fg = c.yellow }) + hi('ModeMsg', { fg = c.orange, bold = true }) + hi('MoreMsg', { fg = c.orange }) + hi('Question', { fg = c.blue }) -- Diff - hi('DiffAdd', { fg = c.blue, bg = c.diff_add }) - hi('DiffChange', { fg = c.yellow, bg = c.diff_chg }) - hi('DiffDelete', { fg = c.red, bg = c.diff_del }) - hi('DiffText', { fg = c.orange_br, bg = c.diff_txt, bold = true }) - hi('Added', { fg = c.blue }) - hi('Changed', { fg = c.yellow }) - hi('Removed', { fg = c.red }) + hi('DiffAdd', { fg = c.blue, bg = c.diff_add }) + hi('DiffChange', { fg = c.yellow, bg = c.diff_chg }) + hi('DiffDelete', { fg = c.red, bg = c.diff_del }) + hi('DiffText', { fg = c.orange_br, bg = c.diff_txt, bold = true }) + hi('Added', { fg = c.blue }) + hi('Changed', { fg = c.yellow }) + hi('Removed', { fg = c.red }) -- Spelling - hi('SpellBad', { undercurl = true, sp = c.red }) - hi('SpellCap', { undercurl = true, sp = c.yellow }) - hi('SpellLocal', { undercurl = true, sp = c.blue }) - hi('SpellRare', { undercurl = true, sp = c.cyan }) + hi('SpellBad', { undercurl = true, sp = c.red }) + hi('SpellCap', { undercurl = true, sp = c.yellow }) + hi('SpellLocal', { undercurl = true, sp = c.blue }) + hi('SpellRare', { undercurl = true, sp = c.cyan }) -- Syntax - hi('Comment', { fg = c.gray4, italic = true }) - hi('Constant', { fg = c.orange_br }) - hi('String', { fg = c.yellow_br }) - hi('Character', { fg = c.yellow_br }) - hi('Number', { fg = c.orange_br }) - hi('Boolean', { fg = c.orange, bold = true }) - hi('Float', { fg = c.orange_br }) - hi('Identifier', { fg = c.fg }) - hi('Function', { fg = c.orange, bold = true }) - hi('Statement', { fg = c.orange }) - hi('Conditional', { fg = c.orange }) - hi('Repeat', { fg = c.orange }) - hi('Label', { fg = c.orange }) - hi('Operator', { fg = c.yellow }) - hi('Keyword', { fg = c.orange, bold = true }) - hi('Exception', { fg = c.red }) - hi('PreProc', { fg = c.blue }) - hi('Include', { fg = c.blue }) - hi('Define', { fg = c.blue }) - hi('Macro', { fg = c.blue }) - hi('PreCondit', { fg = c.blue }) - hi('Type', { fg = c.yellow }) - hi('StorageClass', { fg = c.yellow }) - hi('Structure', { fg = c.yellow }) - hi('Typedef', { fg = c.yellow }) - hi('Special', { fg = c.cyan }) - hi('SpecialChar', { fg = c.cyan }) - hi('Tag', { fg = c.orange }) - hi('Delimiter', { fg = c.gray5 }) - hi('SpecialComment', { fg = c.gray4, italic = true }) - hi('Debug', { fg = c.red }) - hi('Underlined', { underline = true }) - hi('Ignore', { fg = c.gray4 }) - hi('Error', { fg = c.red, bold = true }) - hi('Todo', { fg = c.bg, bg = c.orange, bold = true }) + hi('Comment', { fg = c.gray4, italic = true }) + hi('Constant', { fg = c.orange_br }) + hi('String', { fg = c.yellow_br }) + hi('Character', { fg = c.yellow_br }) + hi('Number', { fg = c.orange_br }) + hi('Boolean', { fg = c.orange, bold = true }) + hi('Float', { fg = c.orange_br }) + hi('Identifier', { fg = c.fg }) + hi('Function', { fg = c.orange, bold = true }) + hi('Statement', { fg = c.orange }) + hi('Conditional', { fg = c.orange }) + hi('Repeat', { fg = c.orange }) + hi('Label', { fg = c.orange }) + hi('Operator', { fg = c.yellow }) + hi('Keyword', { fg = c.orange, bold = true }) + hi('Exception', { fg = c.red }) + hi('PreProc', { fg = c.blue }) + hi('Include', { fg = c.blue }) + hi('Define', { fg = c.blue }) + hi('Macro', { fg = c.blue }) + hi('PreCondit', { fg = c.blue }) + hi('Type', { fg = c.yellow }) + hi('StorageClass', { fg = c.yellow }) + hi('Structure', { fg = c.yellow }) + hi('Typedef', { fg = c.yellow }) + hi('Special', { fg = c.cyan }) + hi('SpecialChar', { fg = c.cyan }) + hi('Tag', { fg = c.orange }) + hi('Delimiter', { fg = c.gray5 }) + hi('SpecialComment', { fg = c.gray4, italic = true }) + hi('Debug', { fg = c.red }) + hi('Underlined', { underline = true }) + hi('Ignore', { fg = c.gray4 }) + hi('Error', { fg = c.red, bold = true }) + hi('Todo', { fg = c.bg, bg = c.orange, bold = true }) -- Treesitter - hi('@variable', { fg = c.fg }) - hi('@variable.builtin', { fg = c.orange_br }) - hi('@variable.parameter', { fg = c.fg }) - hi('@variable.member', { fg = c.fg }) - hi('@constant', { fg = c.orange_br }) - hi('@constant.builtin', { fg = c.orange, bold = true }) - hi('@constant.macro', { fg = c.blue }) - hi('@string', { fg = c.yellow_br }) - hi('@string.escape', { fg = c.cyan }) - hi('@string.special', { fg = c.cyan }) - hi('@character', { fg = c.yellow_br }) - hi('@number', { fg = c.orange_br }) - hi('@boolean', { fg = c.orange, bold = true }) - hi('@float', { fg = c.orange_br }) - hi('@function', { fg = c.orange, bold = true }) - hi('@function.builtin', { fg = c.orange_br }) - hi('@function.call', { fg = c.orange }) - hi('@function.macro', { fg = c.blue }) - hi('@function.method', { fg = c.orange }) - hi('@function.method.call', { fg = c.orange }) - hi('@constructor', { fg = c.yellow }) - hi('@operator', { fg = c.yellow }) - hi('@keyword', { fg = c.orange, bold = true }) - hi('@keyword.function', { fg = c.orange, bold = true }) - hi('@keyword.operator', { fg = c.yellow }) - hi('@keyword.return', { fg = c.orange, bold = true }) - hi('@keyword.import', { fg = c.blue }) - hi('@keyword.conditional', { fg = c.orange }) - hi('@keyword.repeat', { fg = c.orange }) - hi('@keyword.exception', { fg = c.red }) - hi('@type', { fg = c.yellow }) - hi('@type.builtin', { fg = c.yellow, bold = true }) - hi('@type.definition', { fg = c.yellow }) - hi('@attribute', { fg = c.blue }) - hi('@property', { fg = c.fg }) + hi('@variable', { fg = c.fg }) + hi('@variable.builtin', { fg = c.orange_br }) + hi('@variable.parameter', { fg = c.fg }) + hi('@variable.member', { fg = c.fg }) + hi('@constant', { fg = c.orange_br }) + hi('@constant.builtin', { fg = c.orange, bold = true }) + hi('@constant.macro', { fg = c.blue }) + hi('@string', { fg = c.yellow_br }) + hi('@string.escape', { fg = c.cyan }) + hi('@string.special', { fg = c.cyan }) + hi('@character', { fg = c.yellow_br }) + hi('@number', { fg = c.orange_br }) + hi('@boolean', { fg = c.orange, bold = true }) + hi('@float', { fg = c.orange_br }) + hi('@function', { fg = c.orange, bold = true }) + hi('@function.builtin', { fg = c.orange_br }) + hi('@function.call', { fg = c.orange }) + hi('@function.macro', { fg = c.blue }) + hi('@function.method', { fg = c.orange }) + hi('@function.method.call', { fg = c.orange }) + hi('@constructor', { fg = c.yellow }) + hi('@operator', { fg = c.yellow }) + hi('@keyword', { fg = c.orange, bold = true }) + hi('@keyword.function', { fg = c.orange, bold = true }) + hi('@keyword.operator', { fg = c.yellow }) + hi('@keyword.return', { fg = c.orange, bold = true }) + hi('@keyword.import', { fg = c.blue }) + hi('@keyword.conditional', { fg = c.orange }) + hi('@keyword.repeat', { fg = c.orange }) + hi('@keyword.exception', { fg = c.red }) + hi('@type', { fg = c.yellow }) + hi('@type.builtin', { fg = c.yellow, bold = true }) + hi('@type.definition', { fg = c.yellow }) + hi('@attribute', { fg = c.blue }) + hi('@property', { fg = c.fg }) hi('@punctuation.delimiter', { fg = c.gray5 }) - hi('@punctuation.bracket', { fg = c.gray5 }) - hi('@punctuation.special', { fg = c.cyan }) - hi('@comment', { fg = c.gray4, italic = true }) - hi('@comment.documentation', { fg = c.gray5, italic = true }) - hi('@tag', { fg = c.orange }) - hi('@tag.attribute', { fg = c.yellow }) - hi('@tag.delimiter', { fg = c.gray5 }) - hi('@markup.heading', { fg = c.orange, bold = true }) - hi('@markup.bold', { fg = c.yellow_br, bold = true }) - hi('@markup.italic', { fg = c.fg, italic = true }) - hi('@markup.link', { fg = c.blue, underline = true }) - hi('@markup.link.url', { fg = c.blue, underline = true }) - hi('@markup.raw', { fg = c.cyan }) - hi('@markup.list', { fg = c.orange }) + hi('@punctuation.bracket', { fg = c.gray5 }) + hi('@punctuation.special', { fg = c.cyan }) + hi('@comment', { fg = c.gray4, italic = true }) + hi('@comment.documentation', { fg = c.gray5, italic = true }) + hi('@tag', { fg = c.orange }) + hi('@tag.attribute', { fg = c.yellow }) + hi('@tag.delimiter', { fg = c.gray5 }) + hi('@markup.heading', { fg = c.orange, bold = true }) + hi('@markup.bold', { fg = c.yellow_br, bold = true }) + hi('@markup.italic', { fg = c.fg, italic = true }) + hi('@markup.link', { fg = c.blue, underline = true }) + hi('@markup.link.url', { fg = c.blue, underline = true }) + hi('@markup.raw', { fg = c.cyan }) + hi('@markup.list', { fg = c.orange }) -- LSP - hi('LspReferenceText', { bg = c.gray2 }) - hi('LspReferenceRead', { bg = c.gray2 }) - hi('LspReferenceWrite', { bg = c.gray3 }) - hi('LspInlayHint', { fg = c.gray4, italic = true }) - hi('LspCodeLens', { fg = c.gray4, italic = true }) + hi('LspReferenceText', { bg = c.gray2 }) + hi('LspReferenceRead', { bg = c.gray2 }) + hi('LspReferenceWrite', { bg = c.gray3 }) + hi('LspInlayHint', { fg = c.gray4, italic = true }) + hi('LspCodeLens', { fg = c.gray4, italic = true }) -- Diagnostics - hi('DiagnosticError', { fg = c.red }) - hi('DiagnosticWarn', { fg = c.yellow }) - hi('DiagnosticInfo', { fg = c.blue }) - hi('DiagnosticHint', { fg = c.cyan }) - hi('DiagnosticOk', { fg = c.blue }) - hi('DiagnosticVirtualTextError', { fg = c.red, bg = c.vt_err, italic = true }) - hi('DiagnosticVirtualTextWarn', { fg = c.yellow, bg = c.vt_warn, italic = true }) - hi('DiagnosticVirtualTextInfo', { fg = c.blue, bg = c.vt_info, italic = true }) - hi('DiagnosticVirtualTextHint', { fg = c.cyan, bg = c.vt_hint, italic = true }) - hi('DiagnosticUnderlineError', { undercurl = true, sp = c.red }) - hi('DiagnosticUnderlineWarn', { undercurl = true, sp = c.yellow }) - hi('DiagnosticUnderlineInfo', { undercurl = true, sp = c.blue }) - hi('DiagnosticUnderlineHint', { undercurl = true, sp = c.cyan }) + hi('DiagnosticError', { fg = c.red }) + hi('DiagnosticWarn', { fg = c.yellow }) + hi('DiagnosticInfo', { fg = c.blue }) + hi('DiagnosticHint', { fg = c.cyan }) + hi('DiagnosticOk', { fg = c.blue }) + hi('DiagnosticVirtualTextError', { fg = c.red, bg = c.vt_err, italic = true }) + hi('DiagnosticVirtualTextWarn', { fg = c.yellow, bg = c.vt_warn, italic = true }) + hi('DiagnosticVirtualTextInfo', { fg = c.blue, bg = c.vt_info, italic = true }) + hi('DiagnosticVirtualTextHint', { fg = c.cyan, bg = c.vt_hint, italic = true }) + hi('DiagnosticUnderlineError', { undercurl = true, sp = c.red }) + hi('DiagnosticUnderlineWarn', { undercurl = true, sp = c.yellow }) + hi('DiagnosticUnderlineInfo', { undercurl = true, sp = c.blue }) + hi('DiagnosticUnderlineHint', { undercurl = true, sp = c.cyan }) -- Gitsigns - hi('GitSignsAdd', { fg = c.blue }) - hi('GitSignsChange', { fg = c.yellow }) - hi('GitSignsDelete', { fg = c.red }) + hi('GitSignsAdd', { fg = c.blue }) + hi('GitSignsChange', { fg = c.yellow }) + hi('GitSignsDelete', { fg = c.red }) -- Telescope - hi('TelescopeBorder', { fg = c.orange, bg = c.gray1 }) - hi('TelescopeNormal', { fg = c.fg, bg = c.gray1 }) - hi('TelescopePromptBorder', { fg = c.orange_br, bg = c.gray2 }) - hi('TelescopePromptNormal', { fg = c.fg, bg = c.gray2 }) - hi('TelescopePromptPrefix', { fg = c.orange, bg = c.gray2 }) - hi('TelescopeResultsBorder', { fg = c.orange, bg = c.gray1 }) - hi('TelescopePreviewBorder', { fg = c.gray3, bg = c.gray1 }) - hi('TelescopeSelection', { fg = c.sel_fg, bg = c.orange }) - hi('TelescopeSelectionCaret', { fg = c.sel_fg, bg = c.orange }) - hi('TelescopeMatching', { fg = c.orange_br, bold = true }) - hi('TelescopeTitle', { fg = c.orange_br, bold = true }) + hi('TelescopeBorder', { fg = c.orange, bg = c.gray1 }) + hi('TelescopeNormal', { fg = c.fg, bg = c.gray1 }) + hi('TelescopePromptBorder', { fg = c.orange_br, bg = c.gray2 }) + hi('TelescopePromptNormal', { fg = c.fg, bg = c.gray2 }) + hi('TelescopePromptPrefix', { fg = c.orange, bg = c.gray2 }) + hi('TelescopeResultsBorder', { fg = c.orange, bg = c.gray1 }) + hi('TelescopePreviewBorder', { fg = c.gray3, bg = c.gray1 }) + hi('TelescopeSelection', { fg = c.sel_fg, bg = c.orange }) + hi('TelescopeSelectionCaret', { fg = c.sel_fg, bg = c.orange }) + hi('TelescopeMatching', { fg = c.orange_br, bold = true }) + hi('TelescopeTitle', { fg = c.orange_br, bold = true }) -- NeoTree - hi('NeoTreeNormal', { fg = c.fg, bg = c.gray1 }) - hi('NeoTreeNormalNC', { fg = c.fg, bg = c.gray1 }) - hi('NeoTreeVertSplit', { fg = c.gray3, bg = c.gray1 }) - hi('NeoTreeWinSeparator', { fg = c.gray3, bg = c.gray1 }) - hi('NeoTreeDirectoryName',{ fg = c.orange }) - hi('NeoTreeDirectoryIcon',{ fg = c.orange }) - hi('NeoTreeFileName', { fg = c.fg }) - hi('NeoTreeGitAdded', { fg = c.blue }) - hi('NeoTreeGitModified', { fg = c.yellow }) - hi('NeoTreeGitDeleted', { fg = c.red }) + hi('NeoTreeNormal', { fg = c.fg, bg = c.gray1 }) + hi('NeoTreeNormalNC', { fg = c.fg, bg = c.gray1 }) + hi('NeoTreeVertSplit', { fg = c.gray3, bg = c.gray1 }) + hi('NeoTreeWinSeparator', { fg = c.gray3, bg = c.gray1 }) + hi('NeoTreeDirectoryName', { fg = c.orange }) + hi('NeoTreeDirectoryIcon', { fg = c.orange }) + hi('NeoTreeFileName', { fg = c.fg }) + hi('NeoTreeGitAdded', { fg = c.blue }) + hi('NeoTreeGitModified', { fg = c.yellow }) + hi('NeoTreeGitDeleted', { fg = c.red }) hi('NeoTreeIndentMarker', { fg = c.gray3 }) - hi('NeoTreeExpander', { fg = c.orange }) - hi('NeoTreeTitleBar', { fg = c.bg, bg = c.orange, bold = true }) + hi('NeoTreeExpander', { fg = c.orange }) + hi('NeoTreeTitleBar', { fg = c.bg, bg = c.orange, bold = true }) -- Which-key - hi('WhichKey', { fg = c.orange }) - hi('WhichKeyGroup', { fg = c.yellow }) - hi('WhichKeyDesc', { fg = c.fg }) + hi('WhichKey', { fg = c.orange }) + hi('WhichKeyGroup', { fg = c.yellow }) + hi('WhichKeyDesc', { fg = c.fg }) hi('WhichKeySeparator', { fg = c.gray4 }) - hi('WhichKeyFloat', { bg = c.gray1 }) - hi('WhichKeyBorder', { fg = c.orange, bg = c.gray1 }) + hi('WhichKeyFloat', { bg = c.gray1 }) + hi('WhichKeyBorder', { fg = c.orange, bg = c.gray1 }) -- Blink.cmp - hi('BlinkCmpMenu', { fg = c.fg, bg = c.gray1 }) - hi('BlinkCmpMenuBorder', { fg = c.orange, bg = c.gray1 }) - hi('BlinkCmpMenuSelection', { fg = c.sel_fg, bg = c.orange }) - hi('BlinkCmpScrollBarThumb', { bg = c.orange }) + hi('BlinkCmpMenu', { fg = c.fg, bg = c.gray1 }) + hi('BlinkCmpMenuBorder', { fg = c.orange, bg = c.gray1 }) + hi('BlinkCmpMenuSelection', { fg = c.sel_fg, bg = c.orange }) + hi('BlinkCmpScrollBarThumb', { bg = c.orange }) hi('BlinkCmpScrollBarGutter', { bg = c.gray2 }) - hi('BlinkCmpLabel', { fg = c.fg }) - hi('BlinkCmpLabelMatch', { fg = c.orange_br, bold = true }) - hi('BlinkCmpKind', { fg = c.yellow }) - hi('BlinkCmpDoc', { fg = c.fg, bg = c.gray1 }) - hi('BlinkCmpDocBorder', { fg = c.gray3, bg = c.gray1 }) + hi('BlinkCmpLabel', { fg = c.fg }) + hi('BlinkCmpLabelMatch', { fg = c.orange_br, bold = true }) + hi('BlinkCmpKind', { fg = c.yellow }) + hi('BlinkCmpDoc', { fg = c.fg, bg = c.gray1 }) + hi('BlinkCmpDocBorder', { fg = c.gray3, bg = c.gray1 }) -- Mini.statusline - hi('MiniStatuslineModeNormal', { fg = c.bg, bg = c.orange, bold = true }) - hi('MiniStatuslineModeInsert', { fg = c.bg, bg = c.blue, bold = true }) - hi('MiniStatuslineModeVisual', { fg = c.bg, bg = c.yellow, bold = true }) - hi('MiniStatuslineModeReplace', { fg = c.bg, bg = c.red, bold = true }) - hi('MiniStatuslineModeCommand', { fg = c.bg, bg = c.orange_br, bold = true }) - hi('MiniStatuslineModeOther', { fg = c.bg, bg = c.gray4, bold = true }) - hi('MiniStatuslineDevinfo', { fg = c.fg, bg = c.gray2 }) - hi('MiniStatuslineFilename', { fg = c.fg, bg = c.gray2 }) - hi('MiniStatuslineFileinfo', { fg = c.fg, bg = c.gray2 }) - hi('MiniStatuslineInactive', { fg = c.gray4, bg = c.gray1 }) + hi('MiniStatuslineModeNormal', { fg = c.bg, bg = c.orange, bold = true }) + hi('MiniStatuslineModeInsert', { fg = c.bg, bg = c.blue, bold = true }) + hi('MiniStatuslineModeVisual', { fg = c.bg, bg = c.yellow, bold = true }) + hi('MiniStatuslineModeReplace', { fg = c.bg, bg = c.red, bold = true }) + hi('MiniStatuslineModeCommand', { fg = c.bg, bg = c.orange_br, bold = true }) + hi('MiniStatuslineModeOther', { fg = c.bg, bg = c.gray4, bold = true }) + hi('MiniStatuslineDevinfo', { fg = c.fg, bg = c.gray2 }) + hi('MiniStatuslineFilename', { fg = c.fg, bg = c.gray2 }) + hi('MiniStatuslineFileinfo', { fg = c.fg, bg = c.gray2 }) + hi('MiniStatuslineInactive', { fg = c.gray4, bg = c.gray1 }) -- Todo-comments hi('TodoBgTODO', { fg = c.bg, bg = c.orange, bold = true }) - hi('TodoBgNOTE', { fg = c.bg, bg = c.blue, bold = true }) - hi('TodoBgFIX', { fg = c.bg, bg = c.red, bold = true }) + hi('TodoBgNOTE', { fg = c.bg, bg = c.blue, bold = true }) + hi('TodoBgFIX', { fg = c.bg, bg = c.red, bold = true }) hi('TodoBgWARN', { fg = c.bg, bg = c.yellow, bold = true }) hi('TodoBgHACK', { fg = c.bg, bg = c.yellow, bold = true }) - hi('TodoBgPERF', { fg = c.bg, bg = c.cyan, bold = true }) + hi('TodoBgPERF', { fg = c.bg, bg = c.cyan, bold = true }) hi('TodoFgTODO', { fg = c.orange }) hi('TodoFgNOTE', { fg = c.blue }) - hi('TodoFgFIX', { fg = c.red }) + hi('TodoFgFIX', { fg = c.red }) hi('TodoFgWARN', { fg = c.yellow }) hi('TodoFgHACK', { fg = c.yellow }) hi('TodoFgPERF', { fg = c.cyan }) @@ -356,13 +358,17 @@ end -- These autocmds let :colorscheme orng / orng-light work mid-session. -- Note: they fire only if a colors/orng*.vim stub exists; we create one below. vim.api.nvim_create_autocmd('ColorScheme', { - pattern = 'orng', - callback = function() apply(dark, 'dark') end, + pattern = 'orng', + callback = function() + apply(dark, 'dark') + end, }) vim.api.nvim_create_autocmd('ColorScheme', { - pattern = 'orng-light', - callback = function() apply(light, 'light') end, + pattern = 'orng-light', + callback = function() + apply(light, 'light') + end, }) return {} diff --git a/lua/plugins/extras/comment.lua b/lua/plugins/comment.lua similarity index 100% rename from lua/plugins/extras/comment.lua rename to lua/plugins/comment.lua diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index c7bd136..97cf143 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -34,17 +34,17 @@ return { }, formatters_by_ft = { - lua = { 'stylua' }, - python = { 'black' }, - javascript = { 'biome', 'prettier', stop_after_first = true }, - typescript = { 'biome', 'prettier', stop_after_first = true }, + lua = { 'stylua' }, + python = { 'black' }, + javascript = { 'biome', 'prettier', stop_after_first = true }, + typescript = { 'biome', 'prettier', stop_after_first = true }, javascriptreact = { 'biome', 'prettier', stop_after_first = true }, typescriptreact = { 'biome', 'prettier', stop_after_first = true }, - json = { 'biome', 'prettier', stop_after_first = true }, - html = { 'prettier' }, - css = { 'prettier' }, - graphql = { 'prettier' }, - yaml = { 'yamlfmt' }, + json = { 'biome', 'prettier', stop_after_first = true }, + html = { 'prettier' }, + css = { 'prettier' }, + graphql = { 'prettier' }, + yaml = { 'yamlfmt' }, }, }, } diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua index b2b0450..4345ae4 100644 --- a/lua/plugins/debug.lua +++ b/lua/plugins/debug.lua @@ -12,21 +12,87 @@ return { 'nvim-telescope/telescope-dap.nvim', }, keys = { - { '', function() require('dap').continue() end, desc = 'Debug: Start/Continue' }, - { '', function() require('dap').step_into() end, desc = 'Debug: Step Into' }, - { '', function() require('dap').step_over() end, desc = 'Debug: Step Over' }, - { '', function() require('dap').step_out() end, desc = 'Debug: Step Out' }, - { '', function() require('dapui').toggle() end, desc = 'Debug: Toggle UI' }, - { 'b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' }, - { 'B', function() require('dap').set_breakpoint(vim.fn.input 'Condition: ') end, desc = 'Debug: Set Conditional Breakpoint' }, - { 'dv', function() require('telescope').extensions.dap.variables() end, desc = 'Debug: Find [V]ariables' }, - { 'df', function() require('telescope').extensions.dap.frames() end, desc = 'Debug: Find [F]rames' }, - { 'dc', function() require('telescope').extensions.dap.commands() end, desc = 'Debug: Find [C]ommands' }, - { 'db', function() require('telescope').extensions.dap.list_breakpoints() end, desc = 'Debug: List [B]reakpoints' }, + { + '', + function() + require('dap').continue() + end, + desc = 'Debug: Start/Continue', + }, + { + '', + function() + require('dap').step_into() + end, + desc = 'Debug: Step Into', + }, + { + '', + function() + require('dap').step_over() + end, + desc = 'Debug: Step Over', + }, + { + '', + function() + require('dap').step_out() + end, + desc = 'Debug: Step Out', + }, + { + '', + function() + require('dapui').toggle() + end, + desc = 'Debug: Toggle UI', + }, + { + 'b', + function() + require('dap').toggle_breakpoint() + end, + desc = 'Debug: Toggle Breakpoint', + }, + { + 'B', + function() + require('dap').set_breakpoint(vim.fn.input 'Condition: ') + end, + desc = 'Debug: Set Conditional Breakpoint', + }, + { + 'dv', + function() + require('telescope').extensions.dap.variables() + end, + desc = 'Debug: Find [V]ariables', + }, + { + 'df', + function() + require('telescope').extensions.dap.frames() + end, + desc = 'Debug: Find [F]rames', + }, + { + 'dc', + function() + require('telescope').extensions.dap.commands() + end, + desc = 'Debug: Find [C]ommands', + }, + { + 'db', + function() + require('telescope').extensions.dap.list_breakpoints() + end, + desc = 'Debug: List [B]reakpoints', + }, }, config = function() - local dap = require 'dap' - local dapui = require 'dapui' + local dap = require 'dap' + local dapui = require 'dapui' require('mason-nvim-dap').setup { automatic_installation = true, @@ -38,17 +104,23 @@ return { icons = { expanded = 'โ–พ', collapsed = 'โ–ธ', current_frame = '*' }, controls = { icons = { - pause = 'โธ', play = 'โ–ถ', step_into = 'โŽ', step_over = 'โญ', - step_out = 'โฎ', step_back = 'b', run_last = 'โ–ถโ–ถ', - terminate = 'โน', disconnect = 'โ', + pause = 'โธ', + play = 'โ–ถ', + step_into = 'โŽ', + step_over = 'โญ', + step_out = 'โฎ', + step_back = 'b', + run_last = 'โ–ถโ–ถ', + terminate = 'โน', + disconnect = 'โ', }, }, } -- Auto-open/close dapui with debug sessions - dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close -- Go require('dap-go').setup { @@ -57,16 +129,22 @@ return { -- PHP / Xdebug dap.adapters.php = { - type = 'executable', + type = 'executable', command = 'node', - args = { vim.fn.stdpath 'data' .. '/mason/packages/php-debug-adapter/extension/out/phpDebug.js' }, + args = { vim.fn.stdpath 'data' .. '/mason/packages/php-debug-adapter/extension/out/phpDebug.js' }, } dap.configurations.php = { - { type = 'php', request = 'launch', name = 'Listen for Xdebug', port = 9003 }, - { type = 'php', request = 'launch', name = 'Listen for Xdebug (DDEV)', port = 9003, - pathMappings = { ['/var/www/html'] = '${workspaceFolder}' } }, - { type = 'php', request = 'launch', name = 'Run current script', port = 9003, - cwd = '${fileDirname}', program = '${file}', runtimeExecutable = 'php' }, + { type = 'php', request = 'launch', name = 'Listen for Xdebug', port = 9003 }, + { type = 'php', request = 'launch', name = 'Listen for Xdebug (DDEV)', port = 9003, pathMappings = { ['/var/www/html'] = '${workspaceFolder}' } }, + { + type = 'php', + request = 'launch', + name = 'Run current script', + port = 9003, + cwd = '${fileDirname}', + program = '${file}', + runtimeExecutable = 'php', + }, } -- Telescope DAP extension diff --git a/lua/plugins/extras/diffview.lua b/lua/plugins/diffview.lua similarity index 71% rename from lua/plugins/extras/diffview.lua rename to lua/plugins/diffview.lua index 03eef14..3028f9f 100644 --- a/lua/plugins/extras/diffview.lua +++ b/lua/plugins/diffview.lua @@ -6,13 +6,13 @@ -- ds โ€” staged changes (git diff --cached) -- du โ€” unstaged changes (git diff) -- dh โ€” diff against HEAD --- dc โ€” close diffview +-- dq โ€” close diffview -- -- Inside diffview: -- / โ€” next/prev changed file -- [c / ]c โ€” prev/next hunk in file -- s โ€” stage/unstage file (in file panel) --- q / dc โ€” close +-- q / dq โ€” close return { 'sindrets/diffview.nvim', @@ -20,16 +20,16 @@ return { dependencies = { 'nvim-tree/nvim-web-devicons' }, cmd = { 'DiffviewOpen', 'DiffviewClose', 'DiffviewFileHistory' }, keys = { - { 'ds', 'DiffviewOpen --staged', desc = 'git [d]iff [s]taged' }, - { 'du', 'DiffviewOpen', desc = 'git [d]iff [u]nstaged' }, - { 'dh', 'DiffviewOpen HEAD', desc = 'git [d]iff [h]ead' }, - { 'dc', 'DiffviewClose', desc = 'git [d]iff [c]lose' }, + { 'ds', 'DiffviewOpen --staged', desc = 'git [d]iff [s]taged' }, + { 'du', 'DiffviewOpen', desc = 'git [d]iff [u]nstaged' }, + { 'dh', 'DiffviewOpen HEAD', desc = 'git [d]iff [h]ead' }, + { 'dq', 'DiffviewClose', desc = 'git [d]iff [q]uit' }, }, opts = { enhanced_diff_hl = true, view = { default = { - layout = 'diff2_horizontal', -- side by side + layout = 'diff2_horizontal', -- side by side winbar_info = true, }, merge_tool = { diff --git a/lua/plugins/extras/fff.lua b/lua/plugins/fff.lua similarity index 74% rename from lua/plugins/extras/fff.lua rename to lua/plugins/fff.lua index 05bcea6..5e3ed3b 100644 --- a/lua/plugins/extras/fff.lua +++ b/lua/plugins/fff.lua @@ -12,6 +12,12 @@ return { debug = { enabled = false, show_scores = false }, }, keys = { - { 'ff', function() require('fff').find_files() end, desc = 'FFFind files' }, + { + 'ff', + function() + require('fff').find_files() + end, + desc = 'FFFind files', + }, }, } diff --git a/lua/plugins/extras/git-ai-commit.lua b/lua/plugins/git-ai-commit.lua similarity index 85% rename from lua/plugins/extras/git-ai-commit.lua rename to lua/plugins/git-ai-commit.lua index c8c7364..e565e91 100644 --- a/lua/plugins/extras/git-ai-commit.lua +++ b/lua/plugins/git-ai-commit.lua @@ -9,7 +9,7 @@ return { -- Virtual plugin entry โ€” no remote source, just wires deps + config - dir = vim.fn.stdpath('config'), + dir = vim.fn.stdpath 'config', name = 'git-ai-commit', dependencies = { 'ThePrimeagen/99', @@ -22,7 +22,9 @@ return { --- Return the git root for cwd, or nil if not in a repo. local function git_root() local result = vim.system({ 'git', 'rev-parse', '--show-toplevel' }, { text = true }):wait() - if result.code ~= 0 then return nil end + if result.code ~= 0 then + return nil + end return vim.trim(result.stdout) end @@ -55,11 +57,11 @@ return { -- remove ```...``` fences msg = msg:gsub('^```[^\n]*\n', ''):gsub('\n```$', '') -- remove surrounding single/double quotes - msg = msg:match('^["\'](.+)["\']$') or msg + msg = msg:match '^["\'](.+)["\']$' or msg -- split into subject (first line) and body (remaining lines) - local subject = msg:match('^([^\n]+)') or msg - local body = msg:match('^[^\n]+\n(.+)$') or '' + local subject = msg:match '^([^\n]+)' or msg + local body = msg:match '^[^\n]+\n(.+)$' or '' return vim.trim(subject), vim.trim(body) end @@ -85,7 +87,8 @@ return { vim.notify('AI: generating commit messageโ€ฆ', vim.log.levels.INFO) -- 4. build prompt - local prompt = string.format([[ + local prompt = string.format( + [[ You are an expert at writing git commit messages. @@ -106,30 +109,31 @@ Rules: %s -]], diff) +]], + diff + ) -- 5. fire the 99 request via its internal Prompt API local ok, err = pcall(function() - local _99 = require '99' - local Prompt = require '99.prompt' - local CleanUp = require '99.ops.clean-up' - local state = _99.__get_state() + local _99 = require '99' + local Prompt = require '99.prompt' + local CleanUp = require '99.ops.clean-up' + local state = _99.__get_state() local context = Prompt.search(state) context:add_prompt_content(prompt) context:finalize() - local clean_up = CleanUp.make_clean_up(function() context:stop() end) + local clean_up = CleanUp.make_clean_up(function() + context:stop() + end) context:add_clean_up(clean_up) context:start_request(CleanUp.make_observer(clean_up, { on_complete = function(status, response) vim.schedule(function() if status ~= 'success' then - vim.notify( - 'git-ai-commit: AI request ' .. status, - vim.log.levels.ERROR - ) + vim.notify('git-ai-commit: AI request ' .. status, vim.log.levels.ERROR) return end @@ -143,10 +147,7 @@ Rules: local editmsg_path = root .. '/.git/COMMIT_EDITMSG' local f = io.open(editmsg_path, 'w') if not f then - vim.notify( - 'git-ai-commit: could not write to ' .. editmsg_path, - vim.log.levels.ERROR - ) + vim.notify('git-ai-commit: could not write to ' .. editmsg_path, vim.log.levels.ERROR) return end @@ -181,9 +182,9 @@ Rules: vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines) -- Set buffer options for editing - vim.api.nvim_buf_set_option(buf, 'modifiable', true) - vim.api.nvim_buf_set_option(buf, 'buftype', 'acwrite') - vim.api.nvim_buf_set_option(buf, 'swapfile', false) + vim.api.nvim_set_option_value('modifiable', true, { buf = buf }) + vim.api.nvim_set_option_value('buftype', 'acwrite', { buf = buf }) + vim.api.nvim_set_option_value('swapfile', false, { buf = buf }) local width = max_width local height = math.min(#lines + 4, vim.o.lines - 8) @@ -205,11 +206,11 @@ Rules: -- Create button window below local btn_buf = vim.api.nvim_create_buf(false, true) vim.api.nvim_buf_set_lines(btn_buf, 0, -1, false, { '', button_row, '' }) - vim.api.nvim_buf_set_option(btn_buf, 'modifiable', false) - vim.api.nvim_buf_set_option(btn_buf, 'buftype', 'nofile') + vim.api.nvim_set_option_value('modifiable', false, { buf = btn_buf }) + vim.api.nvim_set_option_value('buftype', 'nofile', { buf = btn_buf }) -- Highlight the buttons - local ns = vim.api.nvim_create_namespace('git-ai-commit-buttons') + local ns = vim.api.nvim_create_namespace 'git-ai-commit-buttons' vim.api.nvim_buf_add_highlight(btn_buf, ns, 'Keyword', 1, button_padding, button_padding + 19) vim.api.nvim_buf_add_highlight(btn_buf, ns, 'WarningMsg', 1, button_padding + 23, button_padding + 41) @@ -244,20 +245,14 @@ Rules: close_windows() -- Commit with the edited message - local commit_result = vim.system( - { 'git', 'commit', '-m', edited_msg }, - { text = true } - ):wait() + local commit_result = vim.system({ 'git', 'commit', '-m', edited_msg }, { text = true }):wait() if commit_result.code == 0 then -- Remove temp file on success vim.fn.delete(editmsg_path) vim.notify('Committed successfully!', vim.log.levels.INFO) else - vim.notify( - 'git-ai-commit: commit failed - ' .. vim.trim(commit_result.stderr or ''), - vim.log.levels.ERROR - ) + vim.notify('git-ai-commit: commit failed - ' .. vim.trim(commit_result.stderr or ''), vim.log.levels.ERROR) end end @@ -272,7 +267,7 @@ Rules: vim.keymap.set('i', '', do_cancel, { buffer = buf, desc = 'Cancel commit' }) -- Start in insert mode at the beginning - vim.cmd('normal! gg0') + vim.cmd 'normal! gg0' end) end, })) diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 1694662..f6593fa 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -5,10 +5,10 @@ return { 'lewis6991/gitsigns.nvim', opts = { signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = 'โ€พ' }, + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = 'โ€พ' }, changedelete = { text = '~' }, }, on_attach = function(bufnr) @@ -21,31 +21,43 @@ return { -- Navigation map('n', ']c', function() - if vim.wo.diff then vim.cmd.normal { ']c', bang = true } - else gs.nav_hunk 'next' end + if vim.wo.diff then + vim.cmd.normal { ']c', bang = true } + else + gs.nav_hunk 'next' + end end, { desc = 'Jump to next git [c]hange' }) map('n', '[c', function() - if vim.wo.diff then vim.cmd.normal { '[c', bang = true } - else gs.nav_hunk 'prev' end + if vim.wo.diff then + vim.cmd.normal { '[c', bang = true } + else + gs.nav_hunk 'prev' + end end, { desc = 'Jump to previous git [c]hange' }) -- Hunk actions (visual + normal) - map('v', 'hs', function() gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' }) - map('v', 'hr', function() gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' }) - map('n', 'hs', gs.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gs.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gs.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gs.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', 'hR', gs.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gs.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gs.blame_line, { desc = 'git [b]lame line' }) - map('n', 'hd', gs.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() gs.diffthis '@' end, { desc = 'git [D]iff against last commit' }) + map('v', 'hs', function() + gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'git [s]tage hunk' }) + map('v', 'hr', function() + gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'git [r]eset hunk' }) + map('n', 'hs', gs.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'hb', gs.blame_line, { desc = 'git [b]lame line' }) + map('n', 'hd', gs.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'hD', function() + gs.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) -- Toggles map('n', 'tb', gs.toggle_current_line_blame, { desc = '[T]oggle git [b]lame line' }) - map('n', 'tD', gs.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) + map('n', 'tD', gs.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) end, }, } diff --git a/lua/plugins/extras/lazygit.lua b/lua/plugins/lazygit.lua similarity index 100% rename from lua/plugins/extras/lazygit.lua rename to lua/plugins/lazygit.lua diff --git a/lua/plugins/lint.lua b/lua/plugins/lint.lua index 4984d1e..5544a2d 100644 --- a/lua/plugins/lint.lua +++ b/lua/plugins/lint.lua @@ -13,7 +13,7 @@ return { local augroup = vim.api.nvim_create_augroup('user-lint', { clear = true }) vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { - group = augroup, + group = augroup, callback = function() -- Only lint modifiable buffers to avoid noise in readonly pop-ups if vim.bo.modifiable then diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 60678ce..076172d 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -32,15 +32,15 @@ return { end local tb = require 'telescope.builtin' - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - map('grr', tb.lsp_references, '[G]oto [R]eferences') - map('gri', tb.lsp_implementations, '[G]oto [I]mplementation') - map('grd', tb.lsp_definitions, '[G]oto [D]efinition') - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - map('gO', tb.lsp_document_symbols, 'Open Document Symbols') - map('gW', tb.lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - map('grt', tb.lsp_type_definitions, '[G]oto [T]ype Definition') + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', tb.lsp_references, '[G]oto [R]eferences') + map('gri', tb.lsp_implementations, '[G]oto [I]mplementation') + map('grd', tb.lsp_definitions, '[G]oto [D]efinition') + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('gO', tb.lsp_document_symbols, 'Open Document Symbols') + map('gW', tb.lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + map('grt', tb.lsp_type_definitions, '[G]oto [T]ype Definition') -- Compat helper for 0.10 vs 0.11 local function client_supports(client, method, bufnr) @@ -57,10 +57,14 @@ return { if client and client_supports(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then local hl_group = vim.api.nvim_create_augroup('user-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, group = hl_group, callback = vim.lsp.buf.document_highlight, + buffer = event.buf, + group = hl_group, + callback = vim.lsp.buf.document_highlight, }) vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, group = hl_group, callback = vim.lsp.buf.clear_references, + buffer = event.buf, + group = hl_group, + callback = vim.lsp.buf.clear_references, }) vim.api.nvim_create_autocmd('LspDetach', { group = vim.api.nvim_create_augroup('user-lsp-detach', { clear = true }), @@ -83,20 +87,22 @@ return { -- Diagnostics appearance vim.diagnostic.config { severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, + float = { border = 'rounded', source = 'if_many' }, underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { + signs = vim.g.have_nerd_font and { text = { [vim.diagnostic.severity.ERROR] = '๓ฐ…š ', - [vim.diagnostic.severity.WARN] = '๓ฐ€ช ', - [vim.diagnostic.severity.INFO] = '๓ฐ‹ฝ ', - [vim.diagnostic.severity.HINT] = '๓ฐŒถ ', + [vim.diagnostic.severity.WARN] = '๓ฐ€ช ', + [vim.diagnostic.severity.INFO] = '๓ฐ‹ฝ ', + [vim.diagnostic.severity.HINT] = '๓ฐŒถ ', }, } or {}, virtual_text = { - source = 'if_many', + source = 'if_many', spacing = 2, - format = function(d) return d.message end, + format = function(d) + return d.message + end, }, } @@ -113,10 +119,23 @@ return { }, }, }, + gopls = {}, + intelephense = {}, + ts_ls = {}, + pyright = {}, + cssls = {}, + html = {}, + jsonls = {}, } local ensure_installed = vim.tbl_keys(servers) - vim.list_extend(ensure_installed, { 'stylua' }) + vim.list_extend(ensure_installed, { + 'stylua', + -- formatters (used by conform.nvim) + 'black', + 'prettier', + 'biome', + }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { diff --git a/lua/plugins/extras/markdown.lua b/lua/plugins/markdown.lua similarity index 100% rename from lua/plugins/extras/markdown.lua rename to lua/plugins/markdown.lua diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua index a814715..b5dd4e3 100644 --- a/lua/plugins/mini.lua +++ b/lua/plugins/mini.lua @@ -13,9 +13,6 @@ return { -- Smooth scroll / cursor animations require('mini.animate').setup() - -- Start screen - require('mini.starter').setup() - -- Surround: saiw) sd' sr)' require('mini.surround').setup() diff --git a/lua/plugins/pdf-viewer.lua b/lua/plugins/pdf-viewer.lua index db7913e..4a98f42 100644 --- a/lua/plugins/pdf-viewer.lua +++ b/lua/plugins/pdf-viewer.lua @@ -42,8 +42,12 @@ return { if handle then while true do local name = vim.loop.fs_scandir_next(handle) - if not name then break end - if name:match '^page%-%d+%.png$' then page_count = page_count + 1 end + if not name then + break + end + if name:match '^page%-%d+%.png$' then + page_count = page_count + 1 + end end end @@ -51,7 +55,9 @@ return { local function show_page(page_num) local state = pdf_state[bufnr] - if not state then return end + if not state then + return + end image.clear() vim.bo[bufnr].modifiable = true vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { '' }) @@ -68,9 +74,13 @@ return { local function change_page(delta) local state = pdf_state[bufnr] - if not state then return end + if not state then + return + end local new_page = state.current_page + delta - if new_page < 1 or new_page > state.total_pages then return end + if new_page < 1 or new_page > state.total_pages then + return + end state.current_page = new_page show_page(new_page) end @@ -79,10 +89,18 @@ return { local map = function(lhs, fn, desc) vim.keymap.set('n', lhs, fn, { buffer = bufnr, desc = desc }) end - map('j', function() change_page(1) end, 'PDF: next page') - map('k', function() change_page(-1) end, 'PDF: previous page') - map('', function() change_page(1) end, 'PDF: next page') - map('', function() change_page(-1) end, 'PDF: previous page') + map('j', function() + change_page(1) + end, 'PDF: next page') + map('k', function() + change_page(-1) + end, 'PDF: previous page') + map('', function() + change_page(1) + end, 'PDF: next page') + map('', function() + change_page(-1) + end, 'PDF: previous page') map('q', 'bd!', 'PDF: close') show_page(1) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 96bab04..e5f64ba 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -9,7 +9,9 @@ return { { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make', - cond = function() return vim.fn.executable 'make' == 1 end, + cond = function() + return vim.fn.executable 'make' == 1 + end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, @@ -29,17 +31,17 @@ return { local builtin = require 'telescope.builtin' -- Search keymaps - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files' }) - vim.keymap.set('n', '', builtin.live_grep, { desc = '[ ] Live grep (project)' }) - vim.keymap.set('n', '/', builtin.find_files, { desc = '[/] Find files' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files' }) + vim.keymap.set('n', '', builtin.live_grep, { desc = '[ ] Live grep (project)' }) + vim.keymap.set('n', '/', builtin.find_files, { desc = '[/] Find files' }) -- Grep only open files vim.keymap.set('n', 's/', function() diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 9877149..970a4d9 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -4,15 +4,29 @@ return { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', - main = 'nvim-treesitter.configs', + main = 'nvim-treesitter.configs', opts = { ensure_installed = { - 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', - 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', + 'bash', + 'c', + 'diff', + 'html', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', -- web - 'javascript', 'typescript', 'tsx', 'json', 'css', + 'javascript', + 'typescript', + 'tsx', + 'json', + 'css', -- go / php - 'go', 'php', + 'go', + 'php', }, auto_install = true, highlight = { diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua index d14be1e..6d8c88d 100644 --- a/lua/plugins/which-key.lua +++ b/lua/plugins/which-key.lua @@ -9,22 +9,45 @@ return { icons = { mappings = vim.g.have_nerd_font, keys = vim.g.have_nerd_font and {} or { - Up = ' ', Down = ' ', Left = ' ', Right = ' ', - C = ' ', M = ' ', D = ' ', S = ' ', - CR = ' ', Esc = ' ', - ScrollWheelDown = ' ', ScrollWheelUp = ' ', - NL = ' ', BS = ' ', Space = ' ', Tab = ' ', - F1 = '', F2 = '', F3 = '', F4 = '', - F5 = '', F6 = '', F7 = '', F8 = '', - F9 = '', F10 = '', F11 = '', F12 = '', + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', }, }, spec = { { 's', group = '[S]earch' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - { 'd', group = '[D]ebug' }, + { 'd', group = '[D]ebug / [D]iff' }, { '9', group = 'AI [9]9' }, + { 'f', desc = '[F]ormat buffer' }, + { 'b', desc = 'Debug: Toggle Breakpoint' }, + { 'B', desc = 'Debug: Conditional Breakpoint' }, }, }, }