diff --git a/README.md b/README.md index dc26fb2..e579709 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Google gemini chat for Vim / Neovim. ![futago](https://github.com/yukimemi/futago.vim/assets/6442108/29e371e3-c16e-4b94-8a0c-67a37e26f7b5) -# Features +# Features This plugin is a Google gemini chat for Vim / Neovim. -# Installation +# Installation If you use [folke/lazy.nvim](https://github.com/folke/lazy.nvim). @@ -28,10 +28,11 @@ If you use [yukimemi/dvpm](https://github.com/yukimemi/dvpm). dvpm.add({ url: "yukimemi/futago.vim" }); ``` -# Requirements +# Requirements - [Deno - A modern runtime for JavaScript and TypeScript](https://deno.land/) - [vim-denops/denops.vim: 🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno](https://github.com/vim-denops/denops.vim) + Using Deno.KV, you need the `--unstable-kv` flag. Please specify as below. @@ -40,100 +41,124 @@ let g:denops#server#deno_args = ['-q', '--no-lock', '--unstable-kv', '-A'] ``` - Environment: `GEMINI_API_KEY` + [Get API key](https://ai.google.dev/) -# Usage +# Usage -# Commands +# Commands -`:FutagoHistory` +`: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. -# Config +# Config No settings are required. However, the following settings can be made if necessary. -`g:futago_debug` +`g:futago_debug` + Enable debug messages. + Default is v:false -`g:futago_chat_path` +`g:futago_chat_path` + Path to save chat files. + Default is `xdg.cache()/futago/chat` https://deno.land/x/xdg/src/mod.deno.ts 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` +`g:futago_log_file` + Path to save log files. + Default is `xdg.cache()/futago/log` https://deno.land/x/xdg/src/mod.deno.ts -`g:futago_history_db` +`g:futago_history_db` + Path to save history db (Deno KV). + Default is `xdg.cache()/futago/db/history.db` https://deno.land/x/xdg/src/mod.deno.ts -`g:futago_safety_settings` +`g:futago_safety_settings` [SafetySetting](https://ai.google.dev/api/rest/v1beta/SafetySetting) + Default is no setting. -`g:futago_generation_config` +`g:futago_generation_config` [GenerationConfig](https://ai.google.dev/api/rest/v1beta/GenerationConfig) + Default is no setting. -`g:futago_ai_prompt` +`g:futago_ai_prompt` + AI prompt. + Default is `Gemini`. -`g:futago_human_prompt` +`g:futago_human_prompt` + Human prompt. + Default is `You`. -`g:futago_opener` +`g:futago_opener` + Options are "split", "vsplit", "tabnew", "edit", "new", "vnew". + Default is "tabnew". -# Functions +# Functions -`futago#start_chat([params])` +`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": "user prompt"}, {"role": "model", "parts": "model reply"}]] [Content[]](https://ai.google.dev/api/rest/v1beta/Content) - [safetySettings]: Default is no setting. + [SafetySetting](https://ai.google.dev/api/rest/v1beta/SafetySetting) - [generationConfig]: Default is no setting. + [GenerationConfig](https://ai.google.dev/api/rest/v1beta/GenerationConfig) - [aiPrompt]: Default is `Gemini`. - [humanPrompt]: Default is `You`. -`futago#git_commit([params])` + +`futago#git_commit([params])` Generate a message for git commit based on the `git diff --cached` result. The generated message will be inserted at the current cursor position. - [prompt]: Default is [here](https://github.com/yukimemi/futago.vim/blob/main/denops/futago/consts.ts#L17). + `git diff --cached` result will be appended to the prompt. -# Example +# Example ```vim let g:futago_debug = v:true @@ -161,7 +186,7 @@ nnoremap fc call futago#start_chat({ nnoremap fg call futago#git_commit() ``` -# License +# License Licensed under MIT License. diff --git a/deno.jsonc b/deno.jsonc index 1d9eeb6..379bb22 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -21,11 +21,7 @@ // git hooks "setup-hooks": "deno run --allow-read --allow-run https://pax.deno.dev/kawarimidoll/deno-dev-template/scripts/setup-hooks.ts", "pre-commit": "deno task doc && deno run --allow-read --allow-env --allow-run --allow-write https://pax.deno.dev/kawarimidoll/deno-dev-template/scripts/lint-staged.ts", - "pre-push": "deno task ci", - // doc with podium. (Change plugin name.) - "doc": "deno task markdown && deno task vimdoc", - "markdown": "deno run --allow-net --allow-read --allow-write https://pax.deno.dev/Omochice/podeno/cli.ts markdown --in ./pod/futago.pod --out ./README.md", - "vimdoc": "deno run --allow-net --allow-read --allow-write https://pax.deno.dev/Omochice/podeno/cli.ts vimdoc --in ./pod/futago.pod --out ./doc/futago.txt" + "pre-push": "deno task ci" }, "fmt": { "useTabs": false, diff --git a/doc/futago.txt b/doc/futago.txt index 1f9fde7..2cd200f 100644 --- a/doc/futago.txt +++ b/doc/futago.txt @@ -141,12 +141,14 @@ example: - [aiPrompt]: Default is `Gemini`. - [humanPrompt]: Default is `You`. + `futago#git_commit([params])` *futago#start_chat* Generate a message for git commit based on the `git diff --cached` result. The generated message will be inserted at the current cursor position. - [prompt]: Default is here |https://github.com/yukimemi/futago.vim/blob/main/denops/futago/consts.ts#L17|. + `git diff --cached` result will be appended to the prompt. ============================================================================= diff --git a/pod/futago.pod b/pod/futago.pod deleted file mode 100644 index b2739c0..0000000 --- a/pod/futago.pod +++ /dev/null @@ -1,196 +0,0 @@ ---- -name: futago -description: Google gemini chat for vim. ---- - -=pod - -=head1 futago.vim - -Google gemini chat for Vim / Neovim. - -![futago](https://github.com/yukimemi/futago.vim/assets/6442108/29e371e3-c16e-4b94-8a0c-67a37e26f7b5) - -=head1 Features X - -This plugin is a Google gemini chat for Vim / Neovim. - -=head1 Installation X - -If you use L. - -=begin lua - -{ - "yukimemi/futago.vim", - lazy = false, - dependencies = { - "vim-denops/denops.vim", - }, -} - -=end lua - -If you use L. - -=begin typescript - -dvpm.add({ url: "yukimemi/futago.vim" }); - -=end typescript - -=head1 Requirements X - -=item [Deno - A modern runtime for JavaScript and TypeScript](https://deno.land/) - -=item [vim-denops/denops.vim: 🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno](https://github.com/vim-denops/denops.vim) - -Using Deno.KV, you need the `--unstable-kv` flag. -Please specify as below. - -=begin vim - -let g:denops#server#deno_args = ['-q', '--no-lock', '--unstable-kv', '-A'] - -=end vim - -=item Environment: `GEMINI_API_KEY` - -[Get API key](https://ai.google.dev/) - -=head1 Usage X - -=head1 Commands X - -C<:FutagoHistory> X<: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. - -=head1 Config X - -No settings are required. However, the following settings can be made if necessary. - -C X -Enable debug messages. -Default is v:false - -C X -Path to save chat files. -Default is `xdg.cache()/futago/chat` - -https://deno.land/x/xdg/src/mod.deno.ts - -If you open a past chat file saved in g:futago_chat_path, you can start chatting based on the automatically saved chat history. - -C X -Path to save log files. -Default is `xdg.cache()/futago/log` - -https://deno.land/x/xdg/src/mod.deno.ts - -C X -Path to save history db (Deno KV). -Default is `xdg.cache()/futago/db/history.db` - -https://deno.land/x/xdg/src/mod.deno.ts - -C X - -[SafetySetting](https://ai.google.dev/api/rest/v1beta/SafetySetting) -Default is no setting. - -C X - -[GenerationConfig](https://ai.google.dev/api/rest/v1beta/GenerationConfig) -Default is no setting. - -C X -AI prompt. -Default is `Gemini`. - -C X -Human prompt. -Default is `You`. - -C X -Options are "split", "vsplit", "tabnew", "edit", "new", "vnew". -Default is "tabnew". - - -=head1 Functions X - -C X - -Start Futago chat with params. -params is dictionaly. - -=item [opener]: Default is "tabnew". - -Options are "split", "vsplit", "tabnew", "edit", "new", "vnew". - -=item [history]: List of chat history. - -example: -[{"role": "user", "parts": "user prompt"}, {"role": "model", "parts": "model reply"}]] - -[Content[]](https://ai.google.dev/api/rest/v1beta/Content) - -=item [safetySettings]: Default is no setting. - -[SafetySetting](https://ai.google.dev/api/rest/v1beta/SafetySetting) - -=item [generationConfig]: Default is no setting. - -[GenerationConfig](https://ai.google.dev/api/rest/v1beta/GenerationConfig) - -=item [aiPrompt]: Default is `Gemini`. - -=item [humanPrompt]: Default is `You`. - -C X - -Generate a message for git commit based on the `git diff --cached` result. -The generated message will be inserted at the current cursor position. - -=item [prompt]: Default is L. - -`git diff --cached` result will be appended to the prompt. - -=head1 Example X - -=begin vim - -let g:futago_debug = v:true -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 fc call futago#start_chat({ - \ "opener": "vsplit", - \ "history": [ - \ {"role": "user", "parts": "僕の名前は yukimemi"}, - \ {"role": "model", "parts": "了解!覚えておくね"} - \ ], - \ "humanPrompt": "yukimemi" - \ }) -nnoremap fg call futago#git_commit() - -=end vim - -=head1 License X - -Licensed under MIT License. - -Copyright (c) 2023 yukimemi - -=cut