Update 2024-11-23 16:01 OpenBSD/amd64-t14
This commit is contained in:
@@ -7,7 +7,7 @@ scriptencoding utf-8
|
||||
|
||||
command! -bang -nargs=? -range=-1 -complete=customlist,copilot#CommandComplete Copilot exe copilot#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
|
||||
|
||||
if v:version < 800 || !exists('##CompleteChanged')
|
||||
if v:version < 800 || !exists('##InsertLeavePre')
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -15,9 +15,9 @@ function! s:ColorScheme() abort
|
||||
if &t_Co == 256
|
||||
hi def CopilotSuggestion guifg=#808080 ctermfg=244
|
||||
else
|
||||
hi def CopilotSuggestion guifg=#808080 ctermfg=8
|
||||
hi def CopilotSuggestion guifg=#808080 ctermfg=12
|
||||
endif
|
||||
hi def link CopilotAnnotation Normal
|
||||
hi def link CopilotAnnotation MoreMsg
|
||||
endfunction
|
||||
|
||||
function! s:MapTab() abort
|
||||
@@ -26,7 +26,7 @@ function! s:MapTab() abort
|
||||
endif
|
||||
let tab_map = maparg('<Tab>', 'i', 0, 1)
|
||||
if !has_key(tab_map, 'rhs')
|
||||
imap <script><silent><nowait><expr> <Tab> copilot#Accept()
|
||||
imap <script><silent><nowait><expr> <Tab> empty(get(g:, 'copilot_no_tab_map')) ? copilot#Accept() : "\t"
|
||||
elseif tab_map.rhs !~# 'copilot'
|
||||
if tab_map.expr
|
||||
let tab_fallback = '{ -> ' . tab_map.rhs . ' }'
|
||||
@@ -52,17 +52,20 @@ endfunction
|
||||
|
||||
augroup github_copilot
|
||||
autocmd!
|
||||
autocmd InsertLeave * call s:Event('InsertLeave')
|
||||
autocmd BufLeave * if mode() =~# '^[iR]'|call s:Event('InsertLeave')|endif
|
||||
autocmd FileType * call s:Event('FileType')
|
||||
autocmd InsertLeavePre * call s:Event('InsertLeavePre')
|
||||
autocmd BufLeave * if mode() =~# '^[iR]'|call s:Event('InsertLeavePre')|endif
|
||||
autocmd InsertEnter * call s:Event('InsertEnter')
|
||||
autocmd BufEnter * if mode() =~# '^[iR]'|call s:Event('InsertEnter')|endif
|
||||
autocmd BufEnter * call s:Event('BufEnter')
|
||||
autocmd CursorMovedI * call s:Event('CursorMovedI')
|
||||
autocmd CompleteChanged * call s:Event('CompleteChanged')
|
||||
autocmd ColorScheme,VimEnter * call s:ColorScheme()
|
||||
autocmd VimEnter * call s:MapTab()
|
||||
autocmd VimEnter * call s:MapTab() | call copilot#Init()
|
||||
autocmd BufUnload * call s:Event('BufUnload')
|
||||
autocmd VimLeavePre * call s:Event('VimLeavePre')
|
||||
autocmd BufReadCmd copilot://* setlocal buftype=nofile bufhidden=wipe nobuflisted readonly nomodifiable
|
||||
autocmd BufReadCmd copilot://* setlocal buftype=nofile bufhidden=wipe nobuflisted nomodifiable
|
||||
autocmd BufReadCmd copilot:///log call copilot#logger#BufReadCmd() | setfiletype copilotlog
|
||||
augroup END
|
||||
|
||||
call s:ColorScheme()
|
||||
@@ -81,7 +84,7 @@ if !get(g:, 'copilot_no_maps')
|
||||
if !has('nvim') && &encoding ==# 'utf-8'
|
||||
" avoid 8-bit meta collision with UTF-8 characters
|
||||
let s:restore_encoding = 1
|
||||
set encoding=cp949
|
||||
silent noautocmd set encoding=cp949
|
||||
endif
|
||||
if empty(mapcheck('<M-]>', 'i'))
|
||||
imap <M-]> <Plug>(copilot-next)
|
||||
@@ -96,17 +99,15 @@ if !get(g:, 'copilot_no_maps')
|
||||
imap <M-Right> <Plug>(copilot-accept-word)
|
||||
endif
|
||||
if empty(mapcheck('<M-C-Right>', 'i'))
|
||||
imap <M-Down> <Plug>(copilot-accept-line)
|
||||
imap <M-C-Right> <Plug>(copilot-accept-line)
|
||||
endif
|
||||
finally
|
||||
if exists('s:restore_encoding')
|
||||
set encoding=utf-8
|
||||
silent noautocmd set encoding=utf-8
|
||||
endif
|
||||
endtry
|
||||
endif
|
||||
|
||||
call copilot#Init()
|
||||
|
||||
let s:dir = expand('<sfile>:h:h')
|
||||
if getftime(s:dir . '/doc/copilot.txt') > getftime(s:dir . '/doc/tags')
|
||||
silent! execute 'helptags' fnameescape(s:dir . '/doc')
|
||||
|
||||
Reference in New Issue
Block a user