200 lines
8.1 KiB
Plaintext
200 lines
8.1 KiB
Plaintext
*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_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:
|