forked from github/copilot.vim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopilot.txt
More file actions
206 lines (176 loc) · 8.45 KB
/
copilot.txt
File metadata and controls
206 lines (176 loc) · 8.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
*copilot.txt* GitHub Copilot - Your AI pair programmer
GETTING STARTED *copilot*
Invoke `:Copilot setup` to authenticate and enable GitHub Copilot.
Suggestions are displayed inline and can be accepted by pressing <Tab>. If
inline suggestions do not appear to be working, invoke `:Copilot status` to
verify Copilot is enabled and not experiencing any issues.
COMMANDS *:Copilot*
*:Copilot_disable*
:Copilot disable Globally disable GitHub Copilot inline suggestions.
*:Copilot_enable*
:Copilot enable Re-enable GitHub Copilot after :Copilot disable.
*:Copilot_setup*
:Copilot setup Authenticate and enable GitHub Copilot.
*:Copilot_signout*
:Copilot signout Sign out of GitHub Copilot.
*:Copilot_status*
:Copilot status Check if GitHub Copilot is operational for the current
buffer and report on any issues.
*:Copilot_panel*
:Copilot panel Open a window with up to 10 completions for the
current buffer. Use <CR> to accept a completion.
Maps are also provided for [[ and ]] to jump from
completion to completion. This is the default command
if :Copilot is called without an argument.
*:Copilot_version*
:Copilot version Show version information.
*:Copilot_feedback*
:Copilot feedback Open the website for providing GitHub Copilot
feedback. Be sure to include |:Copilot_version|
output when reporting a bug.
OPTIONS *copilot-options*
*g:copilot_filetypes*
g:copilot_filetypes A dictionary mapping file types to their enabled
status. Most file types are enabled by default, so
generally this is used for opting out.
>
let g:copilot_filetypes = {
\ 'xml': v:false,
\ }
<
Disabling all file types can be done by setting the
special key "*". File types can then be turned back
on individually.
>
let g:copilot_filetypes = {
\ '*': v:false,
\ 'python': v:true,
\ }
<
*b:copilot_enabled*
b:copilot_enabled Set to v:false to disable GitHub Copilot for the
current buffer. Or set to v:true to force enabling
it, overriding g:copilot_filetypes.
*g:copilot_node_command*
g:copilot_node_command Tell Copilot what `node` binary to use with
g:copilot_node_command. This is useful if the `node`
in your PATH is an unsupported version.
>
let g:copilot_node_command =
\ "~/.nodenv/versions/18.18.0/bin/node"
<
*g:copilot_enterprise_uri*
g:copilot_enterprise_uri
If you are using GitHub Copilot Enterprise, set this
to the URI of your GitHub Enterprise instance.
>
let g:copilot_enterprise_uri = 'https://DOMAIN.ghe.com'
<
*g:copilot_proxy*
g:copilot_proxy Tell Copilot what proxy server to use.
>
let g:copilot_proxy = 'http://localhost:3128'
<
If this is not set, Copilot will use the value of
environment variables like $HTTPS_PROXY.
*g:copilot_proxy_strict_ssl*
g:copilot_proxy_strict_ssl
Corporate proxies sometimes use a man-in-the-middle
SSL certificate which is incompatible with GitHub
Copilot. To work around this, SSL certificate
verification can be disabled:
>
let g:copilot_proxy_strict_ssl = v:false
<
You can also tell Node.js to disable SSL verification
by setting the $NODE_TLS_REJECT_UNAUTHORIZED
environment variable to "0".
*g:copilot_workspace_folders*
g:copilot_workspace_folders
A list of "workspace folders" or project roots that
Copilot may use to improve to improve the quality of
suggestions.
>
let g:copilot_workspace_folders =
\ ["~/Projects/myproject"]
<
You can also set b:workspace_folder for an individual
buffer and newly seen values will be added
automatically.
MAPS *copilot-maps*
*copilot-i_<Tab>*
Copilot.vim uses <Tab> to accept the current suggestion. If you have an
existing <Tab> map, that will be used as the fallback when no suggestion is
displayed.
*copilot#Accept()*
If you'd rather use a key that isn't <Tab>, define an <expr> map that calls
copilot#Accept(). Here's an example with CTRL-J:
>
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
<
Lua version:
>
vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', {
expr = true,
replace_keycodes = false
})
vim.g.copilot_no_tab_map = true
<
The argument to copilot#Accept() is the fallback for when no suggestion is
displayed. In this example, a regular carriage return is used. If no
fallback is desired, use an argument of "" (an empty string).
Other Maps ~
Note that M- (a.k.a. meta or alt) maps are highly dependent on your terminal
to function correctly and may be unsupported with your setup. As an
alternative, you can create your own versions that invoke the <Plug> maps
instead. Here's an example that maps CTRL-L to accept one word of the
current suggestion:
>
imap <C-L> <Plug>(copilot-accept-word)
<
Lua version:
>
vim.keymap.set('i', '<C-L>', '<Plug>(copilot-accept-word)')
<
*copilot-i_CTRL-]*
<C-]> Dismiss the current suggestion.
<Plug>(copilot-dismiss)
*copilot-i_ALT-]*
<M-]> Cycle to the next suggestion, if one is available.
<Plug>(copilot-next)
*copilot-i_ALT-[*
<M-[> Cycle to the previous suggestion.
<Plug>(copilot-previous)
*copilot-i_ALT-\*
<M-\> Explicitly request a suggestion, even if Copilot
<Plug>(copilot-suggest) is disabled.
*copilot-i_ALT-Right*
<M-Right> Accept the next word of the current suggestion.
<Plug>(copilot-accept-word)
*copilot-i_ALT-CTRL-Right*
<M-C-Right> Accept the next line of the current suggestion.
<Plug>(copilot-accept-line)
SYNTAX HIGHLIGHTING *copilot-highlighting*
Inline suggestions are highlighted using the CopilotSuggestion group,
defaulting to a medium gray. The best place to override this is with
a |ColorScheme| autocommand:
>
autocmd ColorScheme solarized
\ highlight CopilotSuggestion guifg=#555555 ctermfg=8
<
Lua version:
>
vim.api.nvim_create_autocmd('ColorScheme', {
pattern = 'solarized',
-- group = ...,
callback = function()
vim.api.nvim_set_hl(0, 'CopilotSuggestion', {
fg = '#555555',
ctermfg = 8,
force = true
})
end
})
<
vim:tw=78:et:ft=help:norl: