Google gemini chat for Vim / Neovim.
This plugin is a Google gemini chat for Vim / Neovim.
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" });
- Deno - A modern runtime for JavaScript and TypeScript
- vim-denops/denops.vim: 🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno
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
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
.
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.
call futago#start_chat()
with default argument.
Show list of chat history with quickfix. If you open a past chat file, you can start chatting based on the automatically saved history.
call futago#git_commit()
with default argument.
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
Default is "gemini-1.5-flash"
See Model
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".
let g:futago_debug = v:true
let g:futago_model = "gemini-1.5-flash-latest"
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()<CR>
Licensed under MIT License.
Copyright (c) 2024 yukimemi