little bit overhaul here and there :))

This commit is contained in:
2026-03-21 15:55:58 +01:00
parent 37e4ba19f8
commit 650ef78405
19 changed files with 601 additions and 428 deletions

View File

@@ -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,7 +32,6 @@ 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 {

View File

@@ -80,7 +80,9 @@ 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
@@ -357,12 +359,16 @@ end
-- 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,
callback = function()
apply(dark, 'dark')
end,
})
vim.api.nvim_create_autocmd('ColorScheme', {
pattern = 'orng-light',
callback = function() apply(light, 'light') end,
callback = function()
apply(light, 'light')
end,
})
return {}

View File

@@ -12,17 +12,83 @@ return {
'nvim-telescope/telescope-dap.nvim',
},
keys = {
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
{ '<F1>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
{ '<F2>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
{ '<F3>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
{ '<F7>', function() require('dapui').toggle() end, desc = 'Debug: Toggle UI' },
{ '<leader>b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
{ '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Condition: ') end, desc = 'Debug: Set Conditional Breakpoint' },
{ '<leader>dv', function() require('telescope').extensions.dap.variables() end, desc = 'Debug: Find [V]ariables' },
{ '<leader>df', function() require('telescope').extensions.dap.frames() end, desc = 'Debug: Find [F]rames' },
{ '<leader>dc', function() require('telescope').extensions.dap.commands() end, desc = 'Debug: Find [C]ommands' },
{ '<leader>db', function() require('telescope').extensions.dap.list_breakpoints() end, desc = 'Debug: List [B]reakpoints' },
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: Toggle UI',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Condition: ')
end,
desc = 'Debug: Set Conditional Breakpoint',
},
{
'<leader>dv',
function()
require('telescope').extensions.dap.variables()
end,
desc = 'Debug: Find [V]ariables',
},
{
'<leader>df',
function()
require('telescope').extensions.dap.frames()
end,
desc = 'Debug: Find [F]rames',
},
{
'<leader>dc',
function()
require('telescope').extensions.dap.commands()
end,
desc = 'Debug: Find [C]ommands',
},
{
'<leader>db',
function()
require('telescope').extensions.dap.list_breakpoints()
end,
desc = 'Debug: List [B]reakpoints',
},
},
config = function()
local dap = require 'dap'
@@ -38,9 +104,15 @@ 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 = '',
},
},
}
@@ -63,10 +135,16 @@ return {
}
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 (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

View File

@@ -6,13 +6,13 @@
-- <leader>ds — staged changes (git diff --cached)
-- <leader>du — unstaged changes (git diff)
-- <leader>dh — diff against HEAD
-- <leader>dc — close diffview
-- <leader>dq — close diffview
--
-- Inside diffview:
-- <Tab> / <S-Tab> — next/prev changed file
-- [c / ]c — prev/next hunk in file
-- s — stage/unstage file (in file panel)
-- q / <leader>dc — close
-- q / <leader>dq — close
return {
'sindrets/diffview.nvim',
@@ -23,7 +23,7 @@ return {
{ '<leader>ds', '<cmd>DiffviewOpen --staged<cr>', desc = 'git [d]iff [s]taged' },
{ '<leader>du', '<cmd>DiffviewOpen<cr>', desc = 'git [d]iff [u]nstaged' },
{ '<leader>dh', '<cmd>DiffviewOpen HEAD<cr>', desc = 'git [d]iff [h]ead' },
{ '<leader>dc', '<cmd>DiffviewClose<cr>', desc = 'git [d]iff [c]lose' },
{ '<leader>dq', '<cmd>DiffviewClose<cr>', desc = 'git [d]iff [q]uit' },
},
opts = {
enhanced_diff_hl = true,

View File

@@ -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',
},
},
}

View File

@@ -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(
[[
<DIRECTIONS>
You are an expert at writing git commit messages.
@@ -106,7 +109,9 @@ Rules:
%s
</DIFF>
</DIRECTIONS>
]], diff)
]],
diff
)
-- 5. fire the 99 request via its internal Prompt API
local ok, err = pcall(function()
@@ -119,17 +124,16 @@ Rules:
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', '<C-c>', do_cancel, { buffer = buf, desc = 'Cancel commit' })
-- Start in insert mode at the beginning
vim.cmd('normal! gg0')
vim.cmd 'normal! gg0'
end)
end,
}))

View File

@@ -21,18 +21,28 @@ 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', '<leader>hs', function() gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
map('v', '<leader>hs', function()
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [s]tage hunk' })
map('v', '<leader>hr', function()
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [r]eset hunk' })
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git [S]tage buffer' })
@@ -41,7 +51,9 @@ return {
map('n', '<leader>hp', gs.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gs.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gs.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function() gs.diffthis '@' end, { desc = 'git [D]iff against last commit' })
map('n', '<leader>hD', function()
gs.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = '[T]oggle git [b]lame line' })

View File

@@ -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 }),
@@ -96,7 +100,9 @@ return {
virtual_text = {
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 {

View File

@@ -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()

View File

@@ -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('<Right>', function() change_page(1) end, 'PDF: next page')
map('<Left>', 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('<Right>', function()
change_page(1)
end, 'PDF: next page')
map('<Left>', function()
change_page(-1)
end, 'PDF: previous page')
map('q', '<cmd>bd!<cr>', 'PDF: close')
show_page(1)

View File

@@ -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 },

View File

@@ -7,12 +7,26 @@ return {
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 = {

View File

@@ -9,22 +9,45 @@ return {
icons = {
mappings = vim.g.have_nerd_font,
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ', Down = '<Down> ', Left = '<Left> ', Right = '<Right> ',
C = '<C-…> ', M = '<M-…> ', D = '<D-…> ', S = '<S-…> ',
CR = '<CR> ', Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ', ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ', BS = '<BS> ', Space = '<Space> ', Tab = '<Tab> ',
F1 = '<F1>', F2 = '<F2>', F3 = '<F3>', F4 = '<F4>',
F5 = '<F5>', F6 = '<F6>', F7 = '<F7>', F8 = '<F8>',
F9 = '<F9>', F10 = '<F10>', F11 = '<F11>', F12 = '<F12>',
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
spec = {
{ '<leader>s', group = '[S]earch' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
{ '<leader>d', group = '[D]ebug' },
{ '<leader>d', group = '[D]ebug / [D]iff' },
{ '<leader>9', group = 'AI [9]9' },
{ '<leader>f', desc = '[F]ormat buffer' },
{ '<leader>b', desc = 'Debug: Toggle Breakpoint' },
{ '<leader>B', desc = 'Debug: Conditional Breakpoint' },
},
},
}