|
@@ -13,8 +13,7 @@ nnoremap <LEADER>gid :read !date +\%Y-\%m-\%d<CR>kJ
|
|
|
" Plugins {{{
|
|
|
call plug#begin()
|
|
|
|
|
|
-Plug 'OmniSharp/omnisharp-vim'
|
|
|
-" After :PlugInstall do :OmnisharpInstall
|
|
|
+Plug 'OmniSharp/omnisharp-vim' " After :PlugInstall do :OmnisharpInstall
|
|
|
|
|
|
Plug 'dense-analysis/ale'
|
|
|
|
|
@@ -140,6 +139,80 @@ vnoremap gi :<C-u>call SelectionSurroundWith()<CR>
|
|
|
|
|
|
" }}}
|
|
|
|
|
|
+" C#/.NET specific settings {{{
|
|
|
+" Enable OmniSharp for C# files
|
|
|
+autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
|
|
|
+
|
|
|
+" Optional: Key mappings {{{
|
|
|
+
|
|
|
+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> <Leader>ost <Plug>(omnisharp_type_lookup)
|
|
|
+ autocmd FileType cs nmap <silent> <buffer> K <Plug>(omnisharp_documentation)
|
|
|
+" autocmd FileType cs nmap <silent> <buffer> <Leader>osfs <Plug>(omnisharp_find_symbol)
|
|
|
+ autocmd FileType cs nmap <silent> <buffer> <Leader>F <Plug>(omnisharp_fix_usings)
|
|
|
+" 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
|
|
|
+" autocmd FileType cs nmap <silent> <buffer> <Leader>osgcc <Plug>(omnisharp_global_code_check)
|
|
|
+" " 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>R <Plug>(omnisharp_rename)
|
|
|
+"
|
|
|
+" 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)
|
|
|
+
|
|
|
+ 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)
|
|
|
+augroup END
|
|
|
+" }}}
|
|
|
+
|
|
|
+" Settings: {{{
|
|
|
+set completeopt=menuone,noinsert,noselect,popuphidden
|
|
|
+set completepopup=highlight:Pmenu,border:off
|
|
|
+
|
|
|
+set backspace=indent,eol,start
|
|
|
+set hidden
|
|
|
+set nofixendofline
|
|
|
+set nostartofline
|
|
|
+set splitbelow
|
|
|
+set splitright
|
|
|
+
|
|
|
+set laststatus=2
|
|
|
+set showmode
|
|
|
+set signcolumn=yes
|
|
|
+
|
|
|
+set mouse=a
|
|
|
+set updatetime=1000
|
|
|
+" }}}
|
|
|
+
|
|
|
+" }}}
|
|
|
+
|
|
|
" }}}
|
|
|
|
|
|
" 3rd Party {{{
|
|
@@ -287,41 +360,9 @@ let g:ale_linters = {
|
|
|
\}
|
|
|
|
|
|
let g:ale_fixers = { 'cs': [ 'dotnet-format' ] }
|
|
|
-let g:ale_set_quickfix = 1
|
|
|
-" Copilot suggestion for ALE/OmniSharp quick list co-existence {{{
|
|
|
let g:ale_set_quickfix = 0
|
|
|
let g:ale_set_loclist = 1
|
|
|
" }}}
|
|
|
-" }}}
|
|
|
-
|
|
|
-" C#/.NET specific settings {{{
|
|
|
-" Enable OmniSharp for C# files
|
|
|
-autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
|
|
|
-
|
|
|
-" Optional: Key mappings
|
|
|
-autocmd FileType cs nnoremap <buffer> gd :OmniSharpGotoDefinition<CR>
|
|
|
-autocmd FileType cs nnoremap <buffer> <leader>fi :OmniSharpFindImplementations<CR>
|
|
|
-autocmd FileType cs nnoremap <buffer> <leader>us :OmniSharpFindUsages<CR>
|
|
|
-autocmd FileType cs nnoremap <buffer> K :OmniSharpDocumentation<CR>
|
|
|
-
|
|
|
-" Settings: {{{
|
|
|
-set completeopt=menuone,noinsert,noselect,popuphidden
|
|
|
-set completepopup=highlight:Pmenu,border:off
|
|
|
-
|
|
|
-set backspace=indent,eol,start
|
|
|
-set hidden
|
|
|
-set nofixendofline
|
|
|
-set nostartofline
|
|
|
-set splitbelow
|
|
|
-set splitright
|
|
|
-
|
|
|
-set laststatus=2
|
|
|
-set showmode
|
|
|
-set signcolumn=yes
|
|
|
-
|
|
|
-set mouse=a
|
|
|
-set updatetime=1000
|
|
|
-" }}}
|
|
|
|
|
|
" OmniSharp: {{{
|
|
|
let g:OmniSharp_popup_position = 'peek'
|
|
@@ -332,15 +373,6 @@ if has('nvim')
|
|
|
\ 'border': 'rounded'
|
|
|
\}
|
|
|
else
|
|
|
- "let g:OmniSharp_popup_options = {
|
|
|
- "\ 'highlight': 'Normal',
|
|
|
- "\ 'padding': [0],
|
|
|
- "\ 'winblend': 30,
|
|
|
- "\ 'winhl': 'Normal:Normal,FloatBorder:ModeMsg',
|
|
|
- "\ 'border': [1],
|
|
|
- "\ 'borderchars': ['─', '│', '─', '│', '┌', '┐', '┘', '└'],
|
|
|
- "\ 'borderhighlight': ['ModeMsg']
|
|
|
- "\ }
|
|
|
let g:OmniSharp_popup_options = {
|
|
|
\ 'highlight': 'Normal',
|
|
|
\ 'padding': [1],
|
|
@@ -348,9 +380,6 @@ else
|
|
|
\ 'borderchars': ['─', '│', '─', '│', '╭', '╮', '╯', '╰'],
|
|
|
\ 'borderhighlight': ['Special']
|
|
|
\}
|
|
|
- "\ 'highlight': 'Normal',
|
|
|
- "\ 'winblend': 30,
|
|
|
- "\ 'winhl': 'Normal:Normal,FloatBorder:Special',
|
|
|
endif
|
|
|
let g:OmniSharp_popup_mappings = {
|
|
|
\ 'sigNext': '<C-n>',
|
|
@@ -363,7 +392,6 @@ let g:OmniSharp_highlight_groups = {
|
|
|
\ 'ExcludedCode': 'NonText'
|
|
|
\}
|
|
|
|
|
|
-" }}}
|
|
|
" }}}
|
|
|
|
|
|
" }}}
|