Skip to content

Commit 33b3a2e

Browse files
committedJan 13, 2023
improve docs
1 parent e206708 commit 33b3a2e

File tree

6 files changed

+133
-9
lines changed

6 files changed

+133
-9
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
bin/
2+
doc/tags

‎README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,26 @@ least 0.6)
88
2. Install `Exafunction/codeium.vim` using your vim plugin manager of
99
choice, or manually. See [Installation Options](#installation-options) below.
1010

11-
3. Run `:CodeiumAuth` to set up the plugin and start using Codeium.
11+
3. Run `:Codeium Auth` to set up the plugin and start using Codeium.
1212

13+
You can run `:help codeium` for a full list of commands and configuration
14+
options.
15+
16+
## Configuration
17+
18+
Codeium can be disabled for particular filetypes by setting the
19+
`g:codeium_filetypes` variable in your vim config file (vimrc/init.vim):
20+
21+
```
22+
let g:codeium_filetypes = {
23+
\ "bash": v:false,
24+
\ "typescript": v:true,
25+
\ }
26+
```
27+
28+
Codeium is enabled by default for most filetypes.
29+
30+
For a full list of configuration options you can run `:help codeium`.
1331

1432
## Installation Options
1533

‎autoload/codeium.vim

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ function! codeium#Enabled() abort
2222
return v:false
2323
endif
2424

25-
let codeium_enabled_languages = s:default_codeium_enabled
26-
call extend(codeium_enabled_languages, get(g:, 'codeium_enabled_languages', {}))
27-
if !get(codeium_enabled_languages, &ft, 1)
25+
let codeium_filetypes = s:default_codeium_enabled
26+
call extend(codeium_filetypes, get(g:, 'codeium_filetypes', {}))
27+
if !get(codeium_filetypes, &ft, 1)
2828
return v:false
2929
endif
3030

‎autoload/codeium/server.vim

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
let s:codeium_version = '1.0.0'
2-
let s:ide = 'jetbrains'
3-
let s:ide_version = '1.0.0'
1+
let s:language_server_version = '1.1.14'
2+
3+
if has('nvim')
4+
let s:ide = 'neovim'
5+
else
6+
let s:ide = 'vim'
7+
endif
8+
9+
if !exists('s:editor_version')
10+
if has('nvim')
11+
let s:ide_version = matchstr(execute('version'), 'NVIM v\zs[^[:space:]]\+')
12+
else
13+
let major = v:version / 100
14+
let minor = v:version % 100
15+
if exists('v:versionlong')
16+
let patch = printf('%04d', v:versionlong % 1000)
17+
let s:ide_version = major . '.' . minor . '.' . patch
18+
else
19+
let s:ide_version = major . '.' . minor
20+
endif
21+
endif
22+
endif
423

524
let s:server_port = v:null
625
let s:server_job = v:null
@@ -34,7 +53,7 @@ function! codeium#server#RequestMetadata() abort
3453
\ "api_key": codeium#command#ApiKey(),
3554
\ "ide_name": s:ide,
3655
\ "ide_version": s:ide_version,
37-
\ "extension_version": s:codeium_version,
56+
\ "extension_version": s:language_server_version,
3857
\ }
3958
endfunction
4059

@@ -113,7 +132,7 @@ function! codeium#server#Start() abort
113132
endif
114133

115134
if empty(glob(bin))
116-
let url = 'https://github.com/Exafunction/codeium/releases/download/language-server-v1.1.14/language_server_' . bin_suffix . '.gz'
135+
let url = 'https://github.com/Exafunction/codeium/releases/download/language-server-v' . s:language_server_version . '/language_server_' . bin_suffix . '.gz'
117136
call system('curl -Lo ' . bin . '.gz' . ' ' . url)
118137
call system('gzip -d ' . bin . '.gz')
119138
call system('chmod +x ' . bin)

‎doc/codeium.txt

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
*codeium.txt* Codeium
2+
3+
GETTING STARTED *codeium*
4+
5+
Run the `:Codeium Auth` command to login to Codeium. This is required to
6+
enable the plugin.
7+
8+
Once logged in, suggested completions will be displayed inline as virtual
9+
text. You can insert a completion by pressing <Tab>.
10+
11+
COMMANDS *:Codeium*
12+
13+
*:Codeium_Auth*
14+
:Codeium Auth Authenticate to Codeium.
15+
16+
*:Codeium_Disable*
17+
:Codeium Disable Disable Codeium completions
18+
19+
*:Codeium_Enable*
20+
:Codeium Enable Re-enable Codeium completions after running :Codeium Disable
21+
22+
*:Codeium_DisableBuffer*
23+
:Codeium DisableBuffer Disable Codeium completions in the current buffer only.
24+
25+
*:Codeium_EnableBuffer*
26+
:Codeium EnableBuffer Re-eisable Codeium completions in the current
27+
buffer after running :Codeium DisableBuffer
28+
29+
30+
OPTIONS *codeium-options*
31+
32+
*g:codeium_filetypes*
33+
g:codeium_filetypes A dictionary mapping whether codeium should be
34+
enabled or disabled in certain filetypes. This can
35+
be used to opt out of completions for certain filetypes.
36+
>
37+
let g:codeium_filetypes = {
38+
\ 'bash': v:false,
39+
\ 'typescript': v:true,
40+
\ }
41+
<
42+
43+
*g:codeium_filetypes*
44+
g:codeium_enabled A global boolean flag that controls whether codeium
45+
completions are enabled or disabled by default.
46+
>
47+
let g:codeium_enabled = v:true
48+
<
49+
50+
MAPS *codeium-maps*
51+
52+
*codeium-i_<Tab>*
53+
Codeium.vim defaults to using the <Tab> key to insert the current
54+
suggestion. If there is no suggestion display, the <Tab> key will fallback
55+
to any existing <Tab> mapping you have.
56+
57+
Other Maps ~
58+
59+
*codeium-i_CTRL-]*
60+
<C-]> Dismiss the current suggestion.
61+
<Plug>(codeium-dismiss)
62+
63+
*codeium-i_ALT-]*
64+
<M-]> Cycle to the next suggestion.
65+
<Plug>(codeium-next)
66+
67+
*codeium-i_ALT-[*
68+
<M-[> Cycle to the previous suggestion.
69+
<Plug>(codeium-previous)
70+
71+
SYNTAX HIGHLIGHTING *codeium-highlighting*
72+
73+
Inline suggestions are highlighted using the CodeiumSuggestion group,
74+
which defaults to a gray color. You can configure this highlight group for
75+
your colorscheme in after/colors/<colorschemename>.vim in your
76+
'runtimepath' (e.g., ~/.config/nvim/after/colors/solarized.vim). Example
77+
declaration:
78+
>
79+
highlight CodeiumSuggestion guifg=#555555 ctermfg=8
80+
<
81+
vim:tw=78:et:ft=help:norl:

‎plugin/codeium.vim

+5
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ endif
5353

5454
call s:SetStyle()
5555
call codeium#server#Start()
56+
57+
let s:dir = expand('<sfile>:h:h')
58+
if getftime(s:dir . '/doc/codeium.txt') > getftime(s:dir . '/doc/tags')
59+
silent! execute 'helptags' fnameescape(s:dir . '/doc')
60+
endif

0 commit comments

Comments
 (0)
Please sign in to comment.