diff --git a/lua/autocmd.lua b/lua/autocmd.lua index c5e2d98..c6389a2 100644 --- a/lua/autocmd.lua +++ b/lua/autocmd.lua @@ -20,11 +20,11 @@ vim.api.nvim_create_autocmd('FocusLost', { command = 'silent! wa', -- Save all files when moving away from the window }) --- vim.api.nvim_create_autocmd('InsertLeave', { --- group = autosave_group, --- pattern = '*', --- command = 'silent! wa', -- Save all files when leaving insert mode --- }) +vim.api.nvim_create_autocmd('InsertLeave', { + group = autosave_group, + pattern = '*', + command = 'silent! wa', -- Save all files when leaving insert mode +}) -- vim.api.nvim_create_autocmd('TextChanged', { -- group = autosave_group, @@ -59,7 +59,7 @@ vim.api.nvim_create_autocmd({ 'User' }, { group = fidget_group, callback = function(event) 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 FidgetHelper:report_exit_status(handle, event) handle:finish() diff --git a/lua/keymap.lua b/lua/keymap.lua index 5bfdbed..13baeb1 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -75,9 +75,10 @@ end, { desc = 'Open terminal' }) -- Editing helpers vim.keymap.set('i', '', 'o', { desc = 'Add line below' }) vim.keymap.set('i', '', 'O', { desc = 'Add line above' }) -vim.keymap.set('i', 'jj', '', { desc = 'Exit insert mode' }) -vim.keymap.set('i', 'jk', '', { desc = 'Exit insert mode' }) -vim.keymap.set('i', 'kk', '', { desc = 'Exit insert mode' }) +local esc_keys = { 'jj', 'jk', 'kk' } +for _, key in ipairs(esc_keys) do + vim.keymap.set('i', key, '', { desc = 'Exit insert mode' }) +end vim.keymap.set('i', '', 'ddi', { desc = 'Delete line' }) vim.keymap.set('i', ';', 'mzA;`za', { desc = 'Append a semicolon' }) vim.keymap.set('n', ';', 'mzA;`za', { desc = 'Append a semicolon' }) @@ -119,6 +120,60 @@ vim.keymap.set('n', ']', 'cnext', { desc = 'Next item in quickf vim.keymap.set('n', '[', 'cprevious', { desc = 'Previous item in quickfix list' }) vim.keymap.set('n', 'gd', 'Telescope lsp_definitions', { desc = 'Go to definition' }) +local function open_test() + require('neotest').summary.open() + require('neotest').output_panel.open() +end +-- Testing +local test_maps = { + { + keys = { '', 'tn' }, + action = function() + require('neotest').run.run() + open_test() + end, + desc = 'Run nearest test', + }, + { + keys = { '', 'ta' }, + action = function() + require('neotest').run.run { suite = true } + open_test() + end, + desc = 'Run all tests in the project', + }, + { + keys = { '', 'tp' }, + action = function() + require('neotest').run.run_last() + open_test() + end, + desc = 'Run previous test again', + }, + { + keys = { '', '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', 'tf', function() + require('neotest').run.run(vim.fn.expand '%') + open_test() +end, { desc = 'Run all tests in the current file' }) +vim.keymap.set('n', '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 -- "A command to properly indent json code -- command! FormatJSON %!python -m json.tool diff --git a/lua/plugins/codecompanion.lua b/lua/plugins/codecompanion.lua index 9663a1b..b6f6fa4 100644 --- a/lua/plugins/codecompanion.lua +++ b/lua/plugins/codecompanion.lua @@ -4,12 +4,51 @@ return { 'olimorris/codecompanion.nvim', opts = function(_, opts) opts.adapters = { - copilot = function() + gpt = function() return require('codecompanion.adapters').extend('copilot', { schema = { model = { 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, @@ -23,7 +62,7 @@ return { opts.strategies = { chat = { - adapter = 'copilot', + adapter = 'gemini', slash_commands = { codebase = require('vectorcode.integrations').codecompanion.chat.make_slash_command(), }, @@ -34,6 +73,9 @@ return { }, }, }, + inline = { + adapter = 'flash', + }, } end, dependencies = { diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua index f289f9b..516a2ab 100644 --- a/lua/plugins/debug.lua +++ b/lua/plugins/debug.lua @@ -1,3 +1,4 @@ +require('helpers').edit_cf('pd', '/lua/plugins/debug.lua') -- debug.lua -- -- 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 -- For more information, see |:help nvim-dap-ui| dapui.setup { diff --git a/lua/plugins/vectorcode.lua b/lua/plugins/vectorcode.lua index 6470792..ee1c194 100644 --- a/lua/plugins/vectorcode.lua +++ b/lua/plugins/vectorcode.lua @@ -5,4 +5,7 @@ return { dependencies = { 'nvim-lua/plenary.nvim' }, build = 'pipx upgrade vectorcode', cmd = 'VectorCode', -- if you're lazy-loading VectorCode + opts = { + async_backend = 'lsp', + }, }