A plugin to ask questions to Google's gemini from Neovim.
The purpose of this plugin is having an interface to communicate with Gemini API, this way you don't have to move to your browers.
- Make sure you have
curlinstalled. - Get a Gemini's API key from Google.
- Set the GEMINI_API_KEY environment variable:
export GEMINI_API_KEY=<your api key>.
You can install askGemini with lazy.nvim:
{
'agusnt/askGemini.nvim',
dependencies = { 'MunifTanjim/nui.nvim' }
}The plugin expose the following two commands:
Open a prompt to ask anything you want to gemini.
Open a prompt to ask anything you want to Gemini. Gemini will then respond with the line your cursor is currently on in Vim (or the selected line in normal mode).
If you use a lot of prompts from :AskGeminiPrompt, you can create your own
command to save yourself the extra time of writing the prompt. Just add the
following when configuring the plugin:
require('askGemini').setup({
user_questions = {
{
-- The command AskGeminiGrammar will check grammar and spelling
cmd = 'Grammar',
prompt = 'Check grammar and spelling'
},
{
-- The command AskGeminiGrammar will explain the selected ExplainCode
-- to you
cmd = 'ExplainCode',
prompt = 'What this code does?'
}
}
})The cmd field is the name of the command (with AskGemini prepended;
e.g., if cmd is Grammar, the final command will be :AskGeminiGrammar).
The prompt field contains the prompt that will be sent to Gemini.
The alternatives are great, but they offer too many options, and most focus on coding with AI. I want something simpler that I can extend with only the three options I use from Gemini.

