little bit overhaul here and there :))
This commit is contained in:
9
init.lua
9
init.lua
@@ -16,8 +16,12 @@ require 'config.autocmds'
|
|||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
local out = vim.fn.system {
|
local out = vim.fn.system {
|
||||||
'git', 'clone', '--filter=blob:none', '--branch=stable',
|
'git',
|
||||||
'https://github.com/folke/lazy.nvim.git', lazypath,
|
'clone',
|
||||||
|
'--filter=blob:none',
|
||||||
|
'--branch=stable',
|
||||||
|
'https://github.com/folke/lazy.nvim.git',
|
||||||
|
lazypath,
|
||||||
}
|
}
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
error('Error cloning lazy.nvim:\n' .. out)
|
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
|
-- Load all plugin specs from lua/plugins/*.lua and lua/plugins/extras/*.lua
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
{ import = 'plugins' },
|
{ import = 'plugins' },
|
||||||
{ import = 'plugins.extras' },
|
|
||||||
}, {
|
}, {
|
||||||
ui = {
|
ui = {
|
||||||
icons = vim.g.have_nerd_font and {} or {
|
icons = vim.g.have_nerd_font and {} or {
|
||||||
|
|||||||
@@ -80,7 +80,9 @@ local function apply(c, variant)
|
|||||||
local bg_mode = variant == 'light' and 'light' or 'dark'
|
local bg_mode = variant == 'light' and 'light' or 'dark'
|
||||||
vim.o.background = bg_mode
|
vim.o.background = bg_mode
|
||||||
vim.cmd.highlight 'clear'
|
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 '')
|
vim.g.colors_name = 'orng' .. (variant == 'light' and '-light' or '')
|
||||||
|
|
||||||
-- Editor chrome
|
-- Editor chrome
|
||||||
@@ -282,8 +284,8 @@ local function apply(c, variant)
|
|||||||
hi('NeoTreeNormalNC', { fg = c.fg, bg = c.gray1 })
|
hi('NeoTreeNormalNC', { fg = c.fg, bg = c.gray1 })
|
||||||
hi('NeoTreeVertSplit', { fg = c.gray3, bg = c.gray1 })
|
hi('NeoTreeVertSplit', { fg = c.gray3, bg = c.gray1 })
|
||||||
hi('NeoTreeWinSeparator', { fg = c.gray3, bg = c.gray1 })
|
hi('NeoTreeWinSeparator', { fg = c.gray3, bg = c.gray1 })
|
||||||
hi('NeoTreeDirectoryName',{ fg = c.orange })
|
hi('NeoTreeDirectoryName', { fg = c.orange })
|
||||||
hi('NeoTreeDirectoryIcon',{ fg = c.orange })
|
hi('NeoTreeDirectoryIcon', { fg = c.orange })
|
||||||
hi('NeoTreeFileName', { fg = c.fg })
|
hi('NeoTreeFileName', { fg = c.fg })
|
||||||
hi('NeoTreeGitAdded', { fg = c.blue })
|
hi('NeoTreeGitAdded', { fg = c.blue })
|
||||||
hi('NeoTreeGitModified', { fg = c.yellow })
|
hi('NeoTreeGitModified', { fg = c.yellow })
|
||||||
@@ -357,12 +359,16 @@ end
|
|||||||
-- Note: they fire only if a colors/orng*.vim stub exists; we create one below.
|
-- Note: they fire only if a colors/orng*.vim stub exists; we create one below.
|
||||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
vim.api.nvim_create_autocmd('ColorScheme', {
|
||||||
pattern = 'orng',
|
pattern = 'orng',
|
||||||
callback = function() apply(dark, 'dark') end,
|
callback = function()
|
||||||
|
apply(dark, 'dark')
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
vim.api.nvim_create_autocmd('ColorScheme', {
|
||||||
pattern = 'orng-light',
|
pattern = 'orng-light',
|
||||||
callback = function() apply(light, 'light') end,
|
callback = function()
|
||||||
|
apply(light, 'light')
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -12,17 +12,83 @@ return {
|
|||||||
'nvim-telescope/telescope-dap.nvim',
|
'nvim-telescope/telescope-dap.nvim',
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
|
{
|
||||||
{ '<F1>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
|
'<F5>',
|
||||||
{ '<F2>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
|
function()
|
||||||
{ '<F3>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
|
require('dap').continue()
|
||||||
{ '<F7>', function() require('dapui').toggle() end, desc = 'Debug: Toggle UI' },
|
end,
|
||||||
{ '<leader>b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
|
desc = 'Debug: Start/Continue',
|
||||||
{ '<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' },
|
'<F1>',
|
||||||
{ '<leader>dc', function() require('telescope').extensions.dap.commands() end, desc = 'Debug: Find [C]ommands' },
|
function()
|
||||||
{ '<leader>db', function() require('telescope').extensions.dap.list_breakpoints() end, desc = 'Debug: List [B]reakpoints' },
|
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()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
@@ -38,9 +104,15 @@ return {
|
|||||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||||
controls = {
|
controls = {
|
||||||
icons = {
|
icons = {
|
||||||
pause = '⏸', play = '▶', step_into = '⏎', step_over = '⏭',
|
pause = '⏸',
|
||||||
step_out = '⏮', step_back = 'b', run_last = '▶▶',
|
play = '▶',
|
||||||
terminate = '⏹', disconnect = '⏏',
|
step_into = '⏎',
|
||||||
|
step_over = '⏭',
|
||||||
|
step_out = '⏮',
|
||||||
|
step_back = 'b',
|
||||||
|
run_last = '▶▶',
|
||||||
|
terminate = '⏹',
|
||||||
|
disconnect = '⏏',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -63,10 +135,16 @@ return {
|
|||||||
}
|
}
|
||||||
dap.configurations.php = {
|
dap.configurations.php = {
|
||||||
{ type = 'php', request = 'launch', name = 'Listen for Xdebug', port = 9003 },
|
{ type = 'php', request = 'launch', name = 'Listen for Xdebug', port = 9003 },
|
||||||
{ type = 'php', request = 'launch', name = 'Listen for Xdebug (DDEV)', port = 9003,
|
{ type = 'php', request = 'launch', name = 'Listen for Xdebug (DDEV)', port = 9003, pathMappings = { ['/var/www/html'] = '${workspaceFolder}' } },
|
||||||
pathMappings = { ['/var/www/html'] = '${workspaceFolder}' } },
|
{
|
||||||
{ type = 'php', request = 'launch', name = 'Run current script', port = 9003,
|
type = 'php',
|
||||||
cwd = '${fileDirname}', program = '${file}', runtimeExecutable = 'php' },
|
request = 'launch',
|
||||||
|
name = 'Run current script',
|
||||||
|
port = 9003,
|
||||||
|
cwd = '${fileDirname}',
|
||||||
|
program = '${file}',
|
||||||
|
runtimeExecutable = 'php',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Telescope DAP extension
|
-- Telescope DAP extension
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
-- <leader>ds — staged changes (git diff --cached)
|
-- <leader>ds — staged changes (git diff --cached)
|
||||||
-- <leader>du — unstaged changes (git diff)
|
-- <leader>du — unstaged changes (git diff)
|
||||||
-- <leader>dh — diff against HEAD
|
-- <leader>dh — diff against HEAD
|
||||||
-- <leader>dc — close diffview
|
-- <leader>dq — close diffview
|
||||||
--
|
--
|
||||||
-- Inside diffview:
|
-- Inside diffview:
|
||||||
-- <Tab> / <S-Tab> — next/prev changed file
|
-- <Tab> / <S-Tab> — next/prev changed file
|
||||||
-- [c / ]c — prev/next hunk in file
|
-- [c / ]c — prev/next hunk in file
|
||||||
-- s — stage/unstage file (in file panel)
|
-- s — stage/unstage file (in file panel)
|
||||||
-- q / <leader>dc — close
|
-- q / <leader>dq — close
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'sindrets/diffview.nvim',
|
'sindrets/diffview.nvim',
|
||||||
@@ -23,7 +23,7 @@ return {
|
|||||||
{ '<leader>ds', '<cmd>DiffviewOpen --staged<cr>', desc = 'git [d]iff [s]taged' },
|
{ '<leader>ds', '<cmd>DiffviewOpen --staged<cr>', desc = 'git [d]iff [s]taged' },
|
||||||
{ '<leader>du', '<cmd>DiffviewOpen<cr>', desc = 'git [d]iff [u]nstaged' },
|
{ '<leader>du', '<cmd>DiffviewOpen<cr>', desc = 'git [d]iff [u]nstaged' },
|
||||||
{ '<leader>dh', '<cmd>DiffviewOpen HEAD<cr>', desc = 'git [d]iff [h]ead' },
|
{ '<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 = {
|
opts = {
|
||||||
enhanced_diff_hl = true,
|
enhanced_diff_hl = true,
|
||||||
@@ -12,6 +12,12 @@ return {
|
|||||||
debug = { enabled = false, show_scores = false },
|
debug = { enabled = false, show_scores = false },
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ 'ff', function() require('fff').find_files() end, desc = 'FFFind files' },
|
{
|
||||||
|
'ff',
|
||||||
|
function()
|
||||||
|
require('fff').find_files()
|
||||||
|
end,
|
||||||
|
desc = 'FFFind files',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
-- Virtual plugin entry — no remote source, just wires deps + config
|
-- Virtual plugin entry — no remote source, just wires deps + config
|
||||||
dir = vim.fn.stdpath('config'),
|
dir = vim.fn.stdpath 'config',
|
||||||
name = 'git-ai-commit',
|
name = 'git-ai-commit',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'ThePrimeagen/99',
|
'ThePrimeagen/99',
|
||||||
@@ -22,7 +22,9 @@ return {
|
|||||||
--- Return the git root for cwd, or nil if not in a repo.
|
--- Return the git root for cwd, or nil if not in a repo.
|
||||||
local function git_root()
|
local function git_root()
|
||||||
local result = vim.system({ 'git', 'rev-parse', '--show-toplevel' }, { text = true }):wait()
|
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)
|
return vim.trim(result.stdout)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,11 +57,11 @@ return {
|
|||||||
-- remove ```...``` fences
|
-- remove ```...``` fences
|
||||||
msg = msg:gsub('^```[^\n]*\n', ''):gsub('\n```$', '')
|
msg = msg:gsub('^```[^\n]*\n', ''):gsub('\n```$', '')
|
||||||
-- remove surrounding single/double quotes
|
-- remove surrounding single/double quotes
|
||||||
msg = msg:match('^["\'](.+)["\']$') or msg
|
msg = msg:match '^["\'](.+)["\']$' or msg
|
||||||
|
|
||||||
-- split into subject (first line) and body (remaining lines)
|
-- split into subject (first line) and body (remaining lines)
|
||||||
local subject = msg:match('^([^\n]+)') or msg
|
local subject = msg:match '^([^\n]+)' or msg
|
||||||
local body = msg:match('^[^\n]+\n(.+)$') or ''
|
local body = msg:match '^[^\n]+\n(.+)$' or ''
|
||||||
|
|
||||||
return vim.trim(subject), vim.trim(body)
|
return vim.trim(subject), vim.trim(body)
|
||||||
end
|
end
|
||||||
@@ -85,7 +87,8 @@ return {
|
|||||||
vim.notify('AI: generating commit message…', vim.log.levels.INFO)
|
vim.notify('AI: generating commit message…', vim.log.levels.INFO)
|
||||||
|
|
||||||
-- 4. build prompt
|
-- 4. build prompt
|
||||||
local prompt = string.format([[
|
local prompt = string.format(
|
||||||
|
[[
|
||||||
<DIRECTIONS>
|
<DIRECTIONS>
|
||||||
You are an expert at writing git commit messages.
|
You are an expert at writing git commit messages.
|
||||||
|
|
||||||
@@ -106,7 +109,9 @@ Rules:
|
|||||||
%s
|
%s
|
||||||
</DIFF>
|
</DIFF>
|
||||||
</DIRECTIONS>
|
</DIRECTIONS>
|
||||||
]], diff)
|
]],
|
||||||
|
diff
|
||||||
|
)
|
||||||
|
|
||||||
-- 5. fire the 99 request via its internal Prompt API
|
-- 5. fire the 99 request via its internal Prompt API
|
||||||
local ok, err = pcall(function()
|
local ok, err = pcall(function()
|
||||||
@@ -119,17 +124,16 @@ Rules:
|
|||||||
context:add_prompt_content(prompt)
|
context:add_prompt_content(prompt)
|
||||||
context:finalize()
|
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:add_clean_up(clean_up)
|
||||||
|
|
||||||
context:start_request(CleanUp.make_observer(clean_up, {
|
context:start_request(CleanUp.make_observer(clean_up, {
|
||||||
on_complete = function(status, response)
|
on_complete = function(status, response)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
if status ~= 'success' then
|
if status ~= 'success' then
|
||||||
vim.notify(
|
vim.notify('git-ai-commit: AI request ' .. status, vim.log.levels.ERROR)
|
||||||
'git-ai-commit: AI request ' .. status,
|
|
||||||
vim.log.levels.ERROR
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -143,10 +147,7 @@ Rules:
|
|||||||
local editmsg_path = root .. '/.git/COMMIT_EDITMSG'
|
local editmsg_path = root .. '/.git/COMMIT_EDITMSG'
|
||||||
local f = io.open(editmsg_path, 'w')
|
local f = io.open(editmsg_path, 'w')
|
||||||
if not f then
|
if not f then
|
||||||
vim.notify(
|
vim.notify('git-ai-commit: could not write to ' .. editmsg_path, vim.log.levels.ERROR)
|
||||||
'git-ai-commit: could not write to ' .. editmsg_path,
|
|
||||||
vim.log.levels.ERROR
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -181,9 +182,9 @@ Rules:
|
|||||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
|
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
|
||||||
|
|
||||||
-- Set buffer options for editing
|
-- Set buffer options for editing
|
||||||
vim.api.nvim_buf_set_option(buf, 'modifiable', true)
|
vim.api.nvim_set_option_value('modifiable', true, { buf = buf })
|
||||||
vim.api.nvim_buf_set_option(buf, 'buftype', 'acwrite')
|
vim.api.nvim_set_option_value('buftype', 'acwrite', { buf = buf })
|
||||||
vim.api.nvim_buf_set_option(buf, 'swapfile', false)
|
vim.api.nvim_set_option_value('swapfile', false, { buf = buf })
|
||||||
|
|
||||||
local width = max_width
|
local width = max_width
|
||||||
local height = math.min(#lines + 4, vim.o.lines - 8)
|
local height = math.min(#lines + 4, vim.o.lines - 8)
|
||||||
@@ -205,11 +206,11 @@ Rules:
|
|||||||
-- Create button window below
|
-- Create button window below
|
||||||
local btn_buf = vim.api.nvim_create_buf(false, true)
|
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_lines(btn_buf, 0, -1, false, { '', button_row, '' })
|
||||||
vim.api.nvim_buf_set_option(btn_buf, 'modifiable', false)
|
vim.api.nvim_set_option_value('modifiable', false, { buf = btn_buf })
|
||||||
vim.api.nvim_buf_set_option(btn_buf, 'buftype', 'nofile')
|
vim.api.nvim_set_option_value('buftype', 'nofile', { buf = btn_buf })
|
||||||
|
|
||||||
-- Highlight the buttons
|
-- 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, 'Keyword', 1, button_padding, button_padding + 19)
|
||||||
vim.api.nvim_buf_add_highlight(btn_buf, ns, 'WarningMsg', 1, button_padding + 23, button_padding + 41)
|
vim.api.nvim_buf_add_highlight(btn_buf, ns, 'WarningMsg', 1, button_padding + 23, button_padding + 41)
|
||||||
|
|
||||||
@@ -244,20 +245,14 @@ Rules:
|
|||||||
close_windows()
|
close_windows()
|
||||||
|
|
||||||
-- Commit with the edited message
|
-- Commit with the edited message
|
||||||
local commit_result = vim.system(
|
local commit_result = vim.system({ 'git', 'commit', '-m', edited_msg }, { text = true }):wait()
|
||||||
{ 'git', 'commit', '-m', edited_msg },
|
|
||||||
{ text = true }
|
|
||||||
):wait()
|
|
||||||
|
|
||||||
if commit_result.code == 0 then
|
if commit_result.code == 0 then
|
||||||
-- Remove temp file on success
|
-- Remove temp file on success
|
||||||
vim.fn.delete(editmsg_path)
|
vim.fn.delete(editmsg_path)
|
||||||
vim.notify('Committed successfully!', vim.log.levels.INFO)
|
vim.notify('Committed successfully!', vim.log.levels.INFO)
|
||||||
else
|
else
|
||||||
vim.notify(
|
vim.notify('git-ai-commit: commit failed - ' .. vim.trim(commit_result.stderr or ''), vim.log.levels.ERROR)
|
||||||
'git-ai-commit: commit failed - ' .. vim.trim(commit_result.stderr or ''),
|
|
||||||
vim.log.levels.ERROR
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -272,7 +267,7 @@ Rules:
|
|||||||
vim.keymap.set('i', '<C-c>', do_cancel, { buffer = buf, desc = 'Cancel commit' })
|
vim.keymap.set('i', '<C-c>', do_cancel, { buffer = buf, desc = 'Cancel commit' })
|
||||||
|
|
||||||
-- Start in insert mode at the beginning
|
-- Start in insert mode at the beginning
|
||||||
vim.cmd('normal! gg0')
|
vim.cmd 'normal! gg0'
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
}))
|
}))
|
||||||
@@ -21,18 +21,28 @@ return {
|
|||||||
|
|
||||||
-- Navigation
|
-- Navigation
|
||||||
map('n', ']c', function()
|
map('n', ']c', function()
|
||||||
if vim.wo.diff then vim.cmd.normal { ']c', bang = true }
|
if vim.wo.diff then
|
||||||
else gs.nav_hunk 'next' end
|
vim.cmd.normal { ']c', bang = true }
|
||||||
|
else
|
||||||
|
gs.nav_hunk 'next'
|
||||||
|
end
|
||||||
end, { desc = 'Jump to next git [c]hange' })
|
end, { desc = 'Jump to next git [c]hange' })
|
||||||
|
|
||||||
map('n', '[c', function()
|
map('n', '[c', function()
|
||||||
if vim.wo.diff then vim.cmd.normal { '[c', bang = true }
|
if vim.wo.diff then
|
||||||
else gs.nav_hunk 'prev' end
|
vim.cmd.normal { '[c', bang = true }
|
||||||
|
else
|
||||||
|
gs.nav_hunk 'prev'
|
||||||
|
end
|
||||||
end, { desc = 'Jump to previous git [c]hange' })
|
end, { desc = 'Jump to previous git [c]hange' })
|
||||||
|
|
||||||
-- Hunk actions (visual + normal)
|
-- 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>hs', function()
|
||||||
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
|
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>hs', gs.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git [r]eset 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' })
|
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>hp', gs.preview_hunk, { desc = 'git [p]review hunk' })
|
||||||
map('n', '<leader>hb', gs.blame_line, { desc = 'git [b]lame line' })
|
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', 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
|
-- Toggles
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = '[T]oggle git [b]lame line' })
|
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = '[T]oggle git [b]lame line' })
|
||||||
|
|||||||
@@ -57,10 +57,14 @@ return {
|
|||||||
if client and client_supports(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
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 })
|
local hl_group = vim.api.nvim_create_augroup('user-lsp-highlight', { clear = false })
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
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' }, {
|
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', {
|
vim.api.nvim_create_autocmd('LspDetach', {
|
||||||
group = vim.api.nvim_create_augroup('user-lsp-detach', { clear = true }),
|
group = vim.api.nvim_create_augroup('user-lsp-detach', { clear = true }),
|
||||||
@@ -96,7 +100,9 @@ return {
|
|||||||
virtual_text = {
|
virtual_text = {
|
||||||
source = 'if_many',
|
source = 'if_many',
|
||||||
spacing = 2,
|
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)
|
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-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ return {
|
|||||||
-- Smooth scroll / cursor animations
|
-- Smooth scroll / cursor animations
|
||||||
require('mini.animate').setup()
|
require('mini.animate').setup()
|
||||||
|
|
||||||
-- Start screen
|
|
||||||
require('mini.starter').setup()
|
|
||||||
|
|
||||||
-- Surround: saiw) sd' sr)'
|
-- Surround: saiw) sd' sr)'
|
||||||
require('mini.surround').setup()
|
require('mini.surround').setup()
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,12 @@ return {
|
|||||||
if handle then
|
if handle then
|
||||||
while true do
|
while true do
|
||||||
local name = vim.loop.fs_scandir_next(handle)
|
local name = vim.loop.fs_scandir_next(handle)
|
||||||
if not name then break end
|
if not name then
|
||||||
if name:match '^page%-%d+%.png$' then page_count = page_count + 1 end
|
break
|
||||||
|
end
|
||||||
|
if name:match '^page%-%d+%.png$' then
|
||||||
|
page_count = page_count + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,7 +55,9 @@ return {
|
|||||||
|
|
||||||
local function show_page(page_num)
|
local function show_page(page_num)
|
||||||
local state = pdf_state[bufnr]
|
local state = pdf_state[bufnr]
|
||||||
if not state then return end
|
if not state then
|
||||||
|
return
|
||||||
|
end
|
||||||
image.clear()
|
image.clear()
|
||||||
vim.bo[bufnr].modifiable = true
|
vim.bo[bufnr].modifiable = true
|
||||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { '' })
|
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { '' })
|
||||||
@@ -68,9 +74,13 @@ return {
|
|||||||
|
|
||||||
local function change_page(delta)
|
local function change_page(delta)
|
||||||
local state = pdf_state[bufnr]
|
local state = pdf_state[bufnr]
|
||||||
if not state then return end
|
if not state then
|
||||||
|
return
|
||||||
|
end
|
||||||
local new_page = state.current_page + delta
|
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
|
state.current_page = new_page
|
||||||
show_page(new_page)
|
show_page(new_page)
|
||||||
end
|
end
|
||||||
@@ -79,10 +89,18 @@ return {
|
|||||||
local map = function(lhs, fn, desc)
|
local map = function(lhs, fn, desc)
|
||||||
vim.keymap.set('n', lhs, fn, { buffer = bufnr, desc = desc })
|
vim.keymap.set('n', lhs, fn, { buffer = bufnr, desc = desc })
|
||||||
end
|
end
|
||||||
map('j', function() change_page(1) end, 'PDF: next page')
|
map('j', function()
|
||||||
map('k', function() change_page(-1) end, 'PDF: previous page')
|
change_page(1)
|
||||||
map('<Right>', function() change_page(1) end, 'PDF: next page')
|
end, 'PDF: next page')
|
||||||
map('<Left>', function() change_page(-1) end, 'PDF: previous 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')
|
map('q', '<cmd>bd!<cr>', 'PDF: close')
|
||||||
|
|
||||||
show_page(1)
|
show_page(1)
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ return {
|
|||||||
{
|
{
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
build = 'make',
|
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-telescope/telescope-ui-select.nvim' },
|
||||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||||
|
|||||||
@@ -7,12 +7,26 @@ return {
|
|||||||
main = 'nvim-treesitter.configs',
|
main = 'nvim-treesitter.configs',
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'bash', 'c', 'diff', 'html', 'lua', 'luadoc',
|
'bash',
|
||||||
'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc',
|
'c',
|
||||||
|
'diff',
|
||||||
|
'html',
|
||||||
|
'lua',
|
||||||
|
'luadoc',
|
||||||
|
'markdown',
|
||||||
|
'markdown_inline',
|
||||||
|
'query',
|
||||||
|
'vim',
|
||||||
|
'vimdoc',
|
||||||
-- web
|
-- web
|
||||||
'javascript', 'typescript', 'tsx', 'json', 'css',
|
'javascript',
|
||||||
|
'typescript',
|
||||||
|
'tsx',
|
||||||
|
'json',
|
||||||
|
'css',
|
||||||
-- go / php
|
-- go / php
|
||||||
'go', 'php',
|
'go',
|
||||||
|
'php',
|
||||||
},
|
},
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
|
|||||||
@@ -9,22 +9,45 @@ return {
|
|||||||
icons = {
|
icons = {
|
||||||
mappings = vim.g.have_nerd_font,
|
mappings = vim.g.have_nerd_font,
|
||||||
keys = vim.g.have_nerd_font and {} or {
|
keys = vim.g.have_nerd_font and {} or {
|
||||||
Up = '<Up> ', Down = '<Down> ', Left = '<Left> ', Right = '<Right> ',
|
Up = '<Up> ',
|
||||||
C = '<C-…> ', M = '<M-…> ', D = '<D-…> ', S = '<S-…> ',
|
Down = '<Down> ',
|
||||||
CR = '<CR> ', Esc = '<Esc> ',
|
Left = '<Left> ',
|
||||||
ScrollWheelDown = '<ScrollWheelDown> ', ScrollWheelUp = '<ScrollWheelUp> ',
|
Right = '<Right> ',
|
||||||
NL = '<NL> ', BS = '<BS> ', Space = '<Space> ', Tab = '<Tab> ',
|
C = '<C-…> ',
|
||||||
F1 = '<F1>', F2 = '<F2>', F3 = '<F3>', F4 = '<F4>',
|
M = '<M-…> ',
|
||||||
F5 = '<F5>', F6 = '<F6>', F7 = '<F7>', F8 = '<F8>',
|
D = '<D-…> ',
|
||||||
F9 = '<F9>', F10 = '<F10>', F11 = '<F11>', F12 = '<F12>',
|
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 = {
|
spec = {
|
||||||
{ '<leader>s', group = '[S]earch' },
|
{ '<leader>s', group = '[S]earch' },
|
||||||
{ '<leader>t', group = '[T]oggle' },
|
{ '<leader>t', group = '[T]oggle' },
|
||||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
{ '<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>9', group = 'AI [9]9' },
|
||||||
|
{ '<leader>f', desc = '[F]ormat buffer' },
|
||||||
|
{ '<leader>b', desc = 'Debug: Toggle Breakpoint' },
|
||||||
|
{ '<leader>B', desc = 'Debug: Conditional Breakpoint' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user