Skip to content

Commit

Permalink
add vim command for invoking chat (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimfeld authored Oct 1, 2024
1 parent dfe75c6 commit 5644ac5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions autoload/codeium/command.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions doc/codeium.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions plugin/codeium.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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() <Esc>
:amenu Plugin.Codeium.Disable\ \Codeium\ \(\:CodeiumDisable\) :call CodeiumDisable() <Esc>
:amenu Plugin.Codeium.Manual\ \Codeium\ \AI\ \Autocompletion\ \(\:CodeiumManual\) :call CodeiumManual() <Esc>
:amenu Plugin.Codeium.Automatic\ \Codeium\ \AI\ \Completion\ \(\:CodeiumAuto\) :call CodeiumAuto() <Esc>
:amenu Plugin.Codeium.Toggle\ \Codeium\ \(\:CodeiumToggle\) :call CodeiumToggle() <Esc>
:amenu Plugin.Codeium.Chat\ \Codeium\ \(\:CodeiumChat\) :call CodeiumChat() <Esc>

0 comments on commit 5644ac5

Please sign in to comment.