From 5644ac5a0e098ca0cf5deed1c909c3fa5e9901f3 Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Mon, 30 Sep 2024 17:52:48 -1000 Subject: [PATCH] add vim command for invoking chat (#457) --- README.md | 3 ++- autoload/codeium/command.vim | 4 ++++ doc/codeium.txt | 3 +++ plugin/codeium.vim | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e5d3a910..45ee36a2 100644 --- a/README.md +++ b/README.md @@ -188,10 +188,11 @@ vim-airline supports Codeium out-of-the-box since commit [3854429d](https://gith ### Launching Codeium Chat -Calling the `codeium#Chat()` function will enable search and indexing in the current project and launch Codeium Chat in a new browser window. +Calling the `codeium#Chat()` function or using the `Codeium Chat` command will enable search and indexing in the current project and launch Codeium Chat in a new browser window. ```vim :call codeium#Chat() +:Codeium Chat ``` The project root is determined by looking in Vim's current working directory for some specific files or directories to be present and goes up to parent directories until one is found. This list of hints is user-configurable and the default value is: diff --git a/autoload/codeium/command.vim b/autoload/codeium/command.vim index 4f5f7658..9a90173c 100644 --- a/autoload/codeium/command.vim +++ b/autoload/codeium/command.vim @@ -137,6 +137,10 @@ function! s:commands.Auth(...) abort endif endfunction +function s:commands.Chat(...) abort + call codeium#Chat() +endfunction + function! s:commands.Disable(...) abort let g:codeium_enabled = 0 endfunction diff --git a/doc/codeium.txt b/doc/codeium.txt index d486749a..8c828ed3 100644 --- a/doc/codeium.txt +++ b/doc/codeium.txt @@ -13,6 +13,9 @@ COMMANDS *:Codeium* *:Codeium_Auth* :Codeium Auth Authenticate to Codeium. + *:Codeium_Chat* +:Codeium Chat Open Codeium Chat in a browser window + *:Codeium_Disable* :Codeium Disable Disable Codeium completions diff --git a/plugin/codeium.vim b/plugin/codeium.vim index 6df3101d..36f1bd07 100644 --- a/plugin/codeium.vim +++ b/plugin/codeium.vim @@ -108,8 +108,15 @@ endfun command! CodeiumAuto :silent! call CodeiumAuto() +function! CodeiumChat() + call codeium#Chat() +endfun + +command! CodeiumChat :silent! call CodeiumChat() + :amenu Plugin.Codeium.Enable\ \Codeium\ \(\:CodeiumEnable\) :call CodeiumEnable() :amenu Plugin.Codeium.Disable\ \Codeium\ \(\:CodeiumDisable\) :call CodeiumDisable() :amenu Plugin.Codeium.Manual\ \Codeium\ \AI\ \Autocompletion\ \(\:CodeiumManual\) :call CodeiumManual() :amenu Plugin.Codeium.Automatic\ \Codeium\ \AI\ \Completion\ \(\:CodeiumAuto\) :call CodeiumAuto() :amenu Plugin.Codeium.Toggle\ \Codeium\ \(\:CodeiumToggle\) :call CodeiumToggle() +:amenu Plugin.Codeium.Chat\ \Codeium\ \(\:CodeiumChat\) :call CodeiumChat()