1
0
Fork 0
mirror of synced 2024-11-22 16:55:34 -05:00
ultimate-vim/sources_non_forked/copilot.vim/doc/copilot.txt

167 lines
7.1 KiB
Text

*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 solution. Maps
are also provided for [[ and ]] to jump from solution
to solution. 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. This is a
string in the format of `hostname:port` or
`username:password@host:port`.
>
let g:copilot_proxy = 'localhost:3128'
<
*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
<
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 a file named
after/colors/<colorschemename>.vim in your 'runtimepath' (e.g.,
~/.config/nvim/after/colors/solarized.vim). Example declaration:
>
highlight CopilotSuggestion guifg=#555555 ctermfg=8
<
vim:tw=78:et:ft=help:norl: