More changes

This commit is contained in:
Chris
2025-04-17 08:53:20 +01:00
parent c7d39fe79c
commit 62b3b156fa
5 changed files with 132 additions and 11 deletions

View File

@@ -20,11 +20,11 @@ vim.api.nvim_create_autocmd('FocusLost', {
command = 'silent! wa', -- Save all files when moving away from the window command = 'silent! wa', -- Save all files when moving away from the window
}) })
-- vim.api.nvim_create_autocmd('InsertLeave', { vim.api.nvim_create_autocmd('InsertLeave', {
-- group = autosave_group, group = autosave_group,
-- pattern = '*', pattern = '*',
-- command = 'silent! wa', -- Save all files when leaving insert mode command = 'silent! wa', -- Save all files when leaving insert mode
-- }) })
-- vim.api.nvim_create_autocmd('TextChanged', { -- vim.api.nvim_create_autocmd('TextChanged', {
-- group = autosave_group, -- group = autosave_group,
@@ -59,7 +59,7 @@ vim.api.nvim_create_autocmd({ 'User' }, {
group = fidget_group, group = fidget_group,
callback = function(event) callback = function(event)
local FidgetHelper = require 'utils.fidget_helper' local FidgetHelper = require 'utils.fidget_helper'
local handle = FidgetHelper:pop_progress_handle(event.data.id) local handle = FidgetHelper:pop_progress_handle(event.data.id)
if handle then if handle then
FidgetHelper:report_exit_status(handle, event) FidgetHelper:report_exit_status(handle, event)
handle:finish() handle:finish()

View File

@@ -75,9 +75,10 @@ end, { desc = 'Open terminal' })
-- Editing helpers -- Editing helpers
vim.keymap.set('i', '<C-O>', '<Esc>o', { desc = 'Add line below' }) vim.keymap.set('i', '<C-O>', '<Esc>o', { desc = 'Add line below' })
vim.keymap.set('i', '<C-S-O>', '<Esc>O', { desc = 'Add line above' }) vim.keymap.set('i', '<C-S-O>', '<Esc>O', { desc = 'Add line above' })
vim.keymap.set('i', 'jj', '<Esc>', { desc = 'Exit insert mode' }) local esc_keys = { 'jj', 'jk', 'kk' }
vim.keymap.set('i', 'jk', '<Esc>', { desc = 'Exit insert mode' }) for _, key in ipairs(esc_keys) do
vim.keymap.set('i', 'kk', '<Esc>', { desc = 'Exit insert mode' }) vim.keymap.set('i', key, '<Esc>', { desc = 'Exit insert mode' })
end
vim.keymap.set('i', '<C-D>', '<Esc>ddi', { desc = 'Delete line' }) vim.keymap.set('i', '<C-D>', '<Esc>ddi', { desc = 'Delete line' })
vim.keymap.set('i', '<Leader>;', '<Esc>mzA;<Esc>`za', { desc = 'Append a semicolon' }) vim.keymap.set('i', '<Leader>;', '<Esc>mzA;<Esc>`za', { desc = 'Append a semicolon' })
vim.keymap.set('n', '<Leader>;', 'mzA;<Esc>`za', { desc = 'Append a semicolon' }) vim.keymap.set('n', '<Leader>;', 'mzA;<Esc>`za', { desc = 'Append a semicolon' })
@@ -119,6 +120,60 @@ vim.keymap.set('n', '<Leader>]', '<CMD>cnext<CR>', { desc = 'Next item in quickf
vim.keymap.set('n', '<Leader>[', '<CMD>cprevious<CR>', { desc = 'Previous item in quickfix list' }) vim.keymap.set('n', '<Leader>[', '<CMD>cprevious<CR>', { desc = 'Previous item in quickfix list' })
vim.keymap.set('n', 'gd', '<CMD>Telescope lsp_definitions<CR>', { desc = 'Go to definition' }) vim.keymap.set('n', 'gd', '<CMD>Telescope lsp_definitions<CR>', { desc = 'Go to definition' })
local function open_test()
require('neotest').summary.open()
require('neotest').output_panel.open()
end
-- Testing
local test_maps = {
{
keys = { '<F12>', '<Leader>tn' },
action = function()
require('neotest').run.run()
open_test()
end,
desc = 'Run nearest test',
},
{
keys = { '<F9>', '<Leader>ta' },
action = function()
require('neotest').run.run { suite = true }
open_test()
end,
desc = 'Run all tests in the project',
},
{
keys = { '<F11>', '<Leader>tp' },
action = function()
require('neotest').run.run_last()
open_test()
end,
desc = 'Run previous test again',
},
{
keys = { '<F10>', '<Leader>td' },
action = function()
require('neotest').run.run_last { strategy = 'dap' }
require('neotest').summary.open() -- Note: Doesn't call open_test() like the others
end,
desc = 'Run last test with debugger',
},
}
for _, map_info in ipairs(test_maps) do
for _, key in ipairs(map_info.keys) do
vim.keymap.set('n', key, map_info.action, { desc = map_info.desc })
end
end
vim.keymap.set('n', '<Leader>tf', function()
require('neotest').run.run(vim.fn.expand '%')
open_test()
end, { desc = 'Run all tests in the current file' })
vim.keymap.set('n', '<Leader>tc', function()
require('neotest').summary.close()
require('neotest').output_panel.close()
end, { desc = 'Close test panels' })
-- Leaving this commented out, I will try the format command instead -- Leaving this commented out, I will try the format command instead
-- "A command to properly indent json code -- "A command to properly indent json code
-- command! FormatJSON %!python -m json.tool -- command! FormatJSON %!python -m json.tool

View File

@@ -4,12 +4,51 @@ return {
'olimorris/codecompanion.nvim', 'olimorris/codecompanion.nvim',
opts = function(_, opts) opts = function(_, opts)
opts.adapters = { opts.adapters = {
copilot = function() gpt = function()
return require('codecompanion.adapters').extend('copilot', { return require('codecompanion.adapters').extend('copilot', {
schema = { schema = {
model = { model = {
default = 'gpt-4o', default = 'gpt-4o',
}, },
max_tokens = {
default = 1000000,
},
},
})
end,
flash = function()
return require('codecompanion.adapters').extend('copilot', {
schema = {
model = {
default = 'gemini-2.0-flash',
},
max_tokens = {
default = 1000000,
},
},
})
end,
gemini = function()
return require('codecompanion.adapters').extend('copilot', {
schema = {
model = {
default = 'gemini-2.5-pro',
},
max_tokens = {
default = 1000000,
},
},
})
end,
sonnet = function()
return require('codecompanion.adapters').extend('copilot', {
schema = {
model = {
default = 'claude-3.7-sonnet',
},
max_tokens = {
default = 1000000,
},
}, },
}) })
end, end,
@@ -23,7 +62,7 @@ return {
opts.strategies = { opts.strategies = {
chat = { chat = {
adapter = 'copilot', adapter = 'gemini',
slash_commands = { slash_commands = {
codebase = require('vectorcode.integrations').codecompanion.chat.make_slash_command(), codebase = require('vectorcode.integrations').codecompanion.chat.make_slash_command(),
}, },
@@ -34,6 +73,9 @@ return {
}, },
}, },
}, },
inline = {
adapter = 'flash',
},
} }
end, end,
dependencies = { dependencies = {

View File

@@ -1,3 +1,4 @@
require('helpers').edit_cf('pd', '/lua/plugins/debug.lua')
-- debug.lua -- debug.lua
-- --
-- Shows how to use the DAP plugin to debug your code. -- Shows how to use the DAP plugin to debug your code.
@@ -96,6 +97,26 @@ return {
}, },
} }
dap.adapters.php = {
type = 'executable',
command = 'node',
args = { '/Users/chris/.local/src/vscode-php-debug/out/phpDebug.js' },
}
dap.configurations.php = {
{
type = 'php',
request = 'launch',
name = 'Listen for XDebug',
port = 9003,
log = true,
pathMappings = {
['/var/www/html/'] = vim.fn.getcwd() .. '/',
},
hostname = '0.0.0.0',
},
}
-- Dap UI setup -- Dap UI setup
-- For more information, see |:help nvim-dap-ui| -- For more information, see |:help nvim-dap-ui|
dapui.setup { dapui.setup {

View File

@@ -5,4 +5,7 @@ return {
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'nvim-lua/plenary.nvim' },
build = 'pipx upgrade vectorcode', build = 'pipx upgrade vectorcode',
cmd = 'VectorCode', -- if you're lazy-loading VectorCode cmd = 'VectorCode', -- if you're lazy-loading VectorCode
opts = {
async_backend = 'lsp',
},
} }