debug completion

This commit is contained in:
Jonas Widen 2025-03-17 07:31:29 +01:00
parent bfa9a35040
commit 541607cfbc
2 changed files with 11 additions and 20 deletions

View File

@ -319,8 +319,11 @@ function M.setup()
vim.api.nvim_create_autocmd("TextChangedI", {
pattern = "*",
callback = function()
-- Only trigger if enabled
if vim.b.gemini_completion_enabled then
M.trigger_completion()
end
end
})
-- Clear suggestion on cursor move

View File

@ -43,21 +43,10 @@ function M.setup(opts)
config.setup(opts)
pcall(vim.treesitter.language.require_language, "markdown")
-- Remove this duplicate keymap setup
-- require("gemini.completion").setup()
-- Remove this duplicate keymap
-- vim.keymap.set('i', '<C-g><C-g>', function()
-- require("gemini.completion").trigger_completion()
-- end, { desc = 'Trigger Gemini completion' })
-- Keep only this completion keymap
vim.keymap.set('i', '<C-g><C-g>', function()
-- Force Gemini's omnifunc
vim.api.nvim_command('set omnifunc=v:lua.require\'gemini\'.complete')
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-x><C-o>', true, true, true), 'n', true)
end, { desc = 'Trigger Gemini completion' })
-- Set up completion
completion.setup()
-- Set up commands
vim.api.nvim_create_user_command("Gemini", function(opts)
if opts.args == "" then
vim.notify("Please provide a prompt for Gemini.", vim.log.levels.WARN)
@ -78,6 +67,7 @@ function M.setup(opts)
desc = "Clear Gemini chat history"
})
-- Chat keymaps
vim.keymap.set("n", "<leader>gc", function()
M.prompt_query()
end, { desc = "Chat with Gemini AI" })
@ -92,11 +82,9 @@ function M.setup(opts)
vim.notify("Chat history cleared", vim.log.levels.INFO)
end, { desc = "Clear Gemini chat history" })
-- Change the completion keymap to a more unique combination
vim.keymap.set('i', '<C-g><C-g>', function()
-- Force Gemini's omnifunc
vim.api.nvim_command('set omnifunc=v:lua.require\'gemini\'.complete')
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-x><C-o>', true, true, true), 'n', true)
-- Completion keymaps
vim.keymap.set('i', '<leader>gg', function()
completion.trigger_completion()
end, { desc = 'Trigger Gemini completion' })
end