Bläddra i källkod

add copilot and tidy up 3rd party config

Daniel Sheffield 1 vecka sedan
förälder
incheckning
4be15cebe1
1 ändrade filer med 81 tillägg och 58 borttagningar
  1. 81 58
      vim/vimfiles/vimrc

+ 81 - 58
vim/vimfiles/vimrc

@@ -22,6 +22,10 @@ Plug 'OmniSharp/omnisharp-vim' " After :PlugInstall do :OmnisharpInstall
 Plug 'dense-analysis/ale'
 
 call plug#end()
+
+" Enable OmniSharp for C# files
+autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
+
 " }}}
 
 " Personal {{{
@@ -118,7 +122,7 @@ scriptencoding utf-8
 " Insert date
 nnoremap <LEADER>gid :read !date +\%Y-\%m-\%d<CR>kJ
 
-" Dos2Uni
+" Dos2Unix
 nnoremap <LEADER>gdu :%s/<C-Q><C-M>//g<CR>
 
 
@@ -212,62 +216,6 @@ inoremap `/ ~/
 "set formatoptions+=q
 "set formatoptions+=r
 " }}}
-
-" }}}
-
-" C#/.NET specific settings {{{
-" Enable OmniSharp for C# files
-autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
-
-augroup omnisharp_commands
-  autocmd!
-
-  " Show type information automatically when the cursor stops moving.
-  " Note that the type is echoed to the Vim command line, and will overwrite
-  " any other messages in this space including e.g. ALE linting messages.
-  autocmd CursorHold *.cs OmniSharpTypeLookup
-
-  " The following commands are contextual, based on the cursor position.
-  autocmd FileType cs nmap <silent> <buffer> gd <Plug>(omnisharp_go_to_definition)
-
-  autocmd FileType cs nmap <silent> <buffer> <Leader>U <Plug>(omnisharp_find_usages)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>osfi <Plug>(omnisharp_find_implementations)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>ospd <Plug>(omnisharp_preview_definition)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>ospi <Plug>(omnisharp_preview_implementations)
-  autocmd FileType cs nmap <silent> <buffer> K <Plug>(omnisharp_documentation)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>F <Plug>(omnisharp_fix_usings)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>R <Plug>(omnisharp_rename)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>T <Plug>(omnisharp_run_tests_in_file)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>t <Plug>(omnisharp_run_test)
-  autocmd FileType cs nmap <silent> <buffer> <Leader>A <Plug>(omnisharp_global_code_check)
-
-  " Other settings (currently unused) {{{
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>ost <Plug>(omnisharp_type_lookup)
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>osfs <Plug>(omnisharp_find_symbol)
-  " autocmd FileType cs nmap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
-  " autocmd FileType cs imap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
-  "
-  " " Navigate up and down by method/property/field
-  " autocmd FileType cs nmap <silent> <buffer> [[ <Plug>(omnisharp_navigate_up)
-  " autocmd FileType cs nmap <silent> <buffer> ]] <Plug>(omnisharp_navigate_down)
-  " " Find all code errors/warnings for the current solution and populate the quickfix window
-  " " Contextual code actions (uses fzf, vim-clap, CtrlP or unite.vim selector when available)
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
-  " autocmd FileType cs xmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
-  " " Repeat the last code action performed (does not use a selector)
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
-  " autocmd FileType cs xmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
-  "
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>os= <Plug>(omnisharp_code_format)
-  "
-  "
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>osre <Plug>(omnisharp_restart_server)
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>osst <Plug>(omnisharp_start_server)
-  " autocmd FileType cs nmap <silent> <buffer> <Leader>ossp <Plug>(omnisharp_stop_server)
-  " }}}
-
-augroup END
-
 " }}}
 
 " }}}
@@ -421,7 +369,8 @@ let g:ale_set_quickfix = 0
 let g:ale_set_loclist = 1
 " }}}
 
-" OmniSharp: {{{
+" OmniSharp {{{
+
 let g:OmniSharp_server_use_net6 = 1
 let g:OmniSharp_popup_position = 'peek'
 if has('nvim')
@@ -450,6 +399,78 @@ let g:OmniSharp_highlight_groups = {
 \ 'ExcludedCode': 'NonText'
 \}
 
+augroup omnisharp_commands
+  autocmd!
+
+  " Show type information automatically when the cursor stops moving.
+  " Note that the type is echoed to the Vim command line, and will overwrite
+  " any other messages in this space including e.g. ALE linting messages.
+  autocmd CursorHold *.cs OmniSharpTypeLookup
+
+  " The following commands are contextual, based on the cursor position.
+  autocmd FileType cs nmap <silent> <buffer> gd <Plug>(omnisharp_go_to_definition)
+
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>U <Plug>(omnisharp_find_usages)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>I <Plug>(omnisharp_find_implementations)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>D <Plug>(omnisharp_preview_definition)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>i <Plug>(omnisharp_preview_implementations)
+  autocmd FileType cs nmap <silent> <buffer> K <Plug>(omnisharp_documentation)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>F <Plug>(omnisharp_fix_usings)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>R <Plug>(omnisharp_rename)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>T <Plug>(omnisharp_run_tests_in_file)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>t <Plug>(omnisharp_run_test)
+  autocmd FileType cs nmap <silent> <buffer> <LEADER>A <Plug>(omnisharp_global_code_check)
+
+  " Other settings (currently unused) {{{
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>ost <Plug>(omnisharp_type_lookup)
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>osfs <Plug>(omnisharp_find_symbol)
+  " autocmd FileType cs nmap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
+  " autocmd FileType cs imap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
+  "
+  " " Navigate up and down by method/property/field
+  " autocmd FileType cs nmap <silent> <buffer> [[ <Plug>(omnisharp_navigate_up)
+  " autocmd FileType cs nmap <silent> <buffer> ]] <Plug>(omnisharp_navigate_down)
+  " " Find all code errors/warnings for the current solution and populate the quickfix window
+  " " Contextual code actions (uses fzf, vim-clap, CtrlP or unite.vim selector when available)
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
+  " autocmd FileType cs xmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
+  " " Repeat the last code action performed (does not use a selector)
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
+  " autocmd FileType cs xmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
+  "
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>os= <Plug>(omnisharp_code_format)
+  "
+  "
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>osre <Plug>(omnisharp_restart_server)
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>osst <Plug>(omnisharp_start_server)
+  " autocmd FileType cs nmap <silent> <buffer> <Leader>ossp <Plug>(omnisharp_stop_server)
+  " }}}
+
+augroup END
+
+" }}}
+
+" Copilot {{{
+
+" Disable <TAB> being mapped to copilot#Accept
+let g:copilot_no_tab_map = v:true
+" Map Ctrl-I to accept the current suggestion
+inoremap <silent><script><expr> <C-I> copilot#Accept("\<CR>")
+
+" Custom mappings
+inoremap <C-L> <Plug>(copilot-accept-word)
+inoremap <C-J> <Plug>(copilot-next)
+inoremap <C-K> <Plug>(copilot-previous)
+
+"                                                 *copilot-i_CTRL-]*
+" <C-]>                   Dismiss the current suggestion.
+" <Plug>(copilot-dismiss)
+" 
+"                                                 *copilot-i_ALT-CTRL-Right*
+" 
+" <M-C-Right>             Accept the next line of the current suggestion.
+" <Plug>(copilot-accept-line)
+
 " }}}
 
 " }}}
@@ -460,3 +481,5 @@ unlet g:netrw_banner
 " Clear search highlight after sourcing
 silent! call feedkeys(":nohlsearch\<CR>")
 
+set belloff=all
+