Fixed issues
This commit is contained in:
parent
dad689ded2
commit
c366268b5c
@ -1,4 +1,4 @@
|
||||
-- plugin/gemini/api.lua
|
||||
-- lua/gemini/api.lua
|
||||
|
||||
local M = {}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
-- plugin/gemini/init.lua
|
||||
print(vim.o.runtimepath)
|
||||
require("gemini.api")
|
||||
-- lua/gemini/init.lua
|
||||
|
||||
local api = require("gemini.api")
|
||||
local M = {}
|
||||
|
||||
local function gemini_query(prompt)
|
||||
local response = api.get_response(prompt)
|
||||
@ -23,36 +24,32 @@ local function gemini_query(prompt)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("Gemini", function(opts)
|
||||
-- Make gemini_query available in M so it can be used by the setup function
|
||||
M.gemini_query = gemini_query
|
||||
|
||||
function M.setup()
|
||||
-- Create the user command
|
||||
vim.api.nvim_create_user_command("Gemini", function(opts)
|
||||
local prompt = opts.args
|
||||
if prompt == "" then
|
||||
vim.notify("Please provide a prompt for Gemini.", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
gemini_query(prompt)
|
||||
end, {
|
||||
M.gemini_query(prompt) -- Use M.gemini_query instead of gemini_query
|
||||
end, {
|
||||
desc = "Query Google AI",
|
||||
nargs = "+", -- Require at least one argument
|
||||
complete = "shellcmd", -- Optional: Enable completion
|
||||
})
|
||||
nargs = "+",
|
||||
complete = "shellcmd",
|
||||
})
|
||||
|
||||
-- Keymapping example (optional)
|
||||
vim.keymap.set("n", "<leader>g", function()
|
||||
-- Set up keymapping
|
||||
vim.keymap.set("n", "<leader>g", function()
|
||||
vim.ui.input({ prompt = "Gemini Query: " }, function(input)
|
||||
if input then
|
||||
gemini_query(input)
|
||||
M.gemini_query(input) -- Use M.gemini_query instead of gemini_query
|
||||
end
|
||||
end)
|
||||
end, { desc = "Query Google AI (via Input)" })
|
||||
|
||||
-- Add a setup function (even if it's empty)
|
||||
local function setup()
|
||||
print("gemini.setup() called") -- For debugging
|
||||
require("gemini.api")
|
||||
print("api module loaded:", api) -- For debugging
|
||||
-- Optional: Add any initialization logic here
|
||||
end, { desc = "Query Google AI (via Input)" })
|
||||
end
|
||||
|
||||
return {
|
||||
setup = setup,
|
||||
}
|
||||
return M
|
||||
|
Loading…
x
Reference in New Issue
Block a user