Passing an empty selection to API #730
-
With the addition of agents, I wanted to setup a keybinding to do a quick The goal is to be able to ask a generic question, not based on the current visual selection or buffer. I'm not sure of the best approach to working around this. The current keybind code: -- Ask the Perplexity agent a quick question
{
"<leader>aS",
function()
local input = vim.fn.input("Perplexity: ")
if input ~= "" then
require("CopilotChat").ask("@perplexityai " .. input, {
selection = nil
})
end
end,
desc = "Quick Chat with Perplexity (CopilotChat)",
mode = { "n", "v" },
}, UPDATE - The fixed keymap, following @deathbeam's answer: -- Ask the Perplexity agent a quick question
{
"<leader>aS",
function()
local input = vim.fn.input("Perplexity: ")
if input ~= "" then
require("CopilotChat").ask(input, {
agent = "perplexityai",
selection = false,
})
end
end,
desc = "Perplexity Search (CopilotChat)",
mode = { "n", "v" },
}, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
you can set selection to |
Beta Was this translation helpful? Give feedback.
-
Hi @syaghoubi00 This is a nice usage. Could you open a PR this? Thanks |
Beta Was this translation helpful? Give feedback.
you can set selection to
false
and then it should work