Skip to content

kiddos/gemini.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gemini.nvim

This plugin try to interface Google's Gemini API into neovim.

It does take some practice to prompt this thing, default press <S-Tab> to select the result

demo1.mp4

popup menu

demo2.mp4
demo3.mp4

function hints

demo4.mp4

It sort of works for flutter widget too?

demo5.mp4

and rust?

demo6.mp4

Installation

export GEMINI_API_KEY="<your API key here>"

if working with code with proprietary license, might want to turn function hints off

export DISABLE_GEMINI_INLINE=1
{
  'kiddos/gemini.nvim',
  build = { 'pip install -r requirements.txt', ':UpdateRemotePlugins' },
  config = function()
    require('gemini').setup()
  end
}
use {
  'kiddos/gemini.nvim',
  run = { 'pip install -r requirements.txt', ':UpdateRemotePlugins' },
  config = function()
    require('gemini').setup()
  end,
}

To install manually

pip install pynvim google-generativeai

and run :UpdateRemotePlugins

Settings

  • default setting
require('gemini').setup({
  menu_key = '<C-o>',
  insert_result_key = '<S-Tab>',
  hints_delay = 3000,
  instruction_delay = 2000,
  menu_prompts = {
    {
      name = 'Unit Test Generation',
      command_name = 'GeminiUnitTest',
      menu = 'Unit Test 🚀',
      prompt = 'Write unit tests for the following code\n',
    },
    {
      name = 'Code Review',
      command_name = 'GeminiCodeReview',
      menu = 'Code Review 📜',
      prompt = 'Do a thorough code review for the following code.\nProvide detail explaination and sincere comments.\n',
    },
    {
      name = 'Code Explain',
      command_name = 'GeminiCodeExplain',
      menu = 'Code Explain 👻',
      prompt = 'Explain the following code\nprovide the answer in Markdown\n',
    },
  },
  hints_prompt = [[
Instruction: Use 1 or 2 sentences to describe what the following {filetype} function does:

\`\`\`{filetype}
{code_block}
\`\`\`
  ]],
  instruction_prompt = [[
Context: filename: \`{filename}\`

Instruction: ***{instruction}***

  ]],
})

TODO

  • [ ]