Skip to content

yukimemi/futago.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

futago.vim

DeepWiki

Google gemini chat for Vim / Neovim.

futago

Features

This plugin is a Google gemini chat for Vim / Neovim.

Installation

If you use folke/lazy.nvim.

{
  "yukimemi/futago.vim",
  lazy = false,
  dependencies = {
    "vim-denops/denops.vim",
  },
}

If you use yukimemi/dvpm.

dvpm.add({ url: "yukimemi/futago.vim" });

Requirements

Using Deno.KV, you need the --unstable-kv flag. Please specify as below.

let g:denops#server#deno_args = ['-q', '--no-lock', '--unstable-kv', '-A']
  • Environment: GEMINI_API_KEY

See Get API key

Functions

futago#start_chat([params])

Start Futago chat with params. params is dictionaly.

  • [opener]: Default is "tabnew".

Options are "split", "vsplit", "tabnew", "edit", "new", "vnew".

  • [history]: List of chat history.

example:

[{"role": "user", "parts": [{ "text": "user prompt" }]}, {"role": "model", "parts": [{ "text": "model reply" }]}]

See Content[]

  • [safetySettings]: Default is no setting.

See SafetySetting

  • [generationConfig]: Default is no setting.

See GenerationConfig

  • [aiPrompt]: Default is Gemini.

  • [humanPrompt]: Default is You.

futago#git_commit([params])

Generate a message for git commit based on the git diff --no-ext-diff --staged result. The generated message will be inserted at the current cursor position.

  • [prompt]: Default is here.

git diff --no-ext-diff --staged result will be appended to the prompt.

Commands

:FutagoStartChat

call futago#start_chat() with default argument.

:FutagoHistory

Show list of chat history with quickfix. If you open a past chat file, you can start chatting based on the automatically saved history.

:FutagoGitCommit

call futago#git_commit() with default argument.

Config

No settings are required. However, the following settings can be made if necessary.

  • g:futago_debug

Enable debug messages.

Default is v:false

  • g:futago_model

Gemini API model.

Default is "gemini-flash-latest"

See Model

  • g:futago_git_model

Gemini API model used by futago#git_commit().

Default is "gemini-flash-latest"

  • g:futago_chat_path

Path to save chat files.

Default is (await dir("cache"))/futago/chat

See @cross/dir - JSR

If you open a past chat file saved in g:futago_chat_path, you can start chatting based on the automatically saved chat history.

  • g:futago_log_file

Path to save log files.

Default is (await dir("cache"))/futago/log

See @cross/dir - JSR

  • g:futago_history_db

Path to save history db (Deno KV).

Default is (await dir("cache"))/futago/db/history.db

See @cross/dir - JSR

  • g:futago_safety_settings

See SafetySetting

Default is no setting.

  • g:futago_generation_config

See GenerationConfig

Default is no setting.

  • g:futago_ai_prompt

AI prompt.

Default is Gemini.

  • g:futago_human_prompt

Human prompt.

Default is You.

  • g:futago_opener

Options are "split", "vsplit", "tabnew", "edit", "new", "vnew".

Default is "tabnew".

Example

let g:futago_debug = v:true
let g:futago_model = "gemini-3-pro-preview"
let g:futago_chat_path = '~/.cache/vim/futago/chat'
let g:futago_log_file = '~/.cache/vim/futago/log/futago.log'
let g:futago_history_db = '~/.cache/vim/futago/db/history.db'
let g:futago_safety_settings = [
  \ { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE" },
  \ { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_NONE"  },
  \ { "category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_ONLY_HIGH" },
  \ { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE" },
  \ ]
let g:futago_generation_config = {
  \   "temperature": 0.9,
  \   "maxOutputTokens": 256,
  \ }
nnoremap <Leader>fc <Cmd>call futago#start_chat({
  \ "opener": "vsplit",
  \ "history": [
  \   {"role": "user", "parts": [{ "text": "僕の名前は yukimemi" }]},
  \   {"role": "model", "parts": [{ "text": "了解!覚えておくね" }]},
  \ ],
  \ "humanPrompt": "yukimemi"
  \ })<CR>
nnoremap <Leader>fg <Cmd>call futago#git_commit({ "model": "gemini-3-flash-preview" })<CR>

License

Licensed under MIT License.

Copyright (c) 2024 yukimemi

About

Google gemini ai chat for vim

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •