A collection of scripts and configurations for Bash (and others)
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

69 lines
3.8KB

  1. " Configuration borrowed from...
  2. " https://github.com/OmniSharp/omnisharp-vim
  3. " Use the stdio version of OmniSharp-roslyn - this is the default
  4. let g:OmniSharp_server_stdio = 1
  5. let g:OmniSharp_server_use_mono = 1
  6. " Don't autoselect first omnicomplete option, show options even if there is only
  7. " one (so the preview documentation is accessible). Remove 'preview', 'popup'
  8. " and 'popuphidden' if you don't want to see any documentation whatsoever.
  9. " Note that neovim does not support `popuphidden` or `popup` yet:
  10. " https://github.com/neovim/neovim/issues/10996
  11. if has('patch-8.1.1880')
  12. set completeopt=longest,menuone,popuphidden
  13. " Highlight the completion documentation popup background/foreground the same as
  14. " the completion menu itself, for better readability with highlighted
  15. " documentation.
  16. set completepopup=highlight:Pmenu,border:off
  17. else
  18. set completeopt=longest,menuone,preview
  19. " Set desired preview window height for viewing documentation.
  20. set previewheight=5
  21. endif
  22. " Tell ALE to use OmniSharp for linting C# files, and no other linters.
  23. let g:ale_linters = { 'cs': ['OmniSharp'] }
  24. augroup omnisharp_commands
  25. autocmd!
  26. " Show type information automatically when the cursor stops moving.
  27. " Note that the type is echoed to the Vim command line, and will overwrite
  28. " any other messages in this space including e.g. ALE linting messages.
  29. autocmd CursorHold *.cs OmniSharpTypeLookup
  30. " The following commands are contextual, based on the cursor position.
  31. autocmd FileType cs nmap <silent> <buffer> gd <Plug>(omnisharp_go_to_definition)
  32. autocmd FileType cs nmap <silent> <buffer> <Leader>osfu <Plug>(omnisharp_find_usages)
  33. autocmd FileType cs nmap <silent> <buffer> <Leader>osfi <Plug>(omnisharp_find_implementations)
  34. autocmd FileType cs nmap <silent> <buffer> <Leader>ospd <Plug>(omnisharp_preview_definition)
  35. autocmd FileType cs nmap <silent> <buffer> <Leader>ospi <Plug>(omnisharp_preview_implementations)
  36. autocmd FileType cs nmap <silent> <buffer> <Leader>ost <Plug>(omnisharp_type_lookup)
  37. autocmd FileType cs nmap <silent> <buffer> <Leader>osd <Plug>(omnisharp_documentation)
  38. autocmd FileType cs nmap <silent> <buffer> <Leader>osfs <Plug>(omnisharp_find_symbol)
  39. autocmd FileType cs nmap <silent> <buffer> <Leader>osfx <Plug>(omnisharp_fix_usings)
  40. autocmd FileType cs nmap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
  41. autocmd FileType cs imap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
  42. " Navigate up and down by method/property/field
  43. autocmd FileType cs nmap <silent> <buffer> [[ <Plug>(omnisharp_navigate_up)
  44. autocmd FileType cs nmap <silent> <buffer> ]] <Plug>(omnisharp_navigate_down)
  45. " Find all code errors/warnings for the current solution and populate the quickfix window
  46. autocmd FileType cs nmap <silent> <buffer> <Leader>osgcc <Plug>(omnisharp_global_code_check)
  47. " Contextual code actions (uses fzf, vim-clap, CtrlP or unite.vim selector when available)
  48. autocmd FileType cs nmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
  49. autocmd FileType cs xmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
  50. " Repeat the last code action performed (does not use a selector)
  51. autocmd FileType cs nmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
  52. autocmd FileType cs xmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
  53. autocmd FileType cs nmap <silent> <buffer> <Leader>os= <Plug>(omnisharp_code_format)
  54. autocmd FileType cs nmap <silent> <buffer> <Leader>osnm <Plug>(omnisharp_rename)
  55. autocmd FileType cs nmap <silent> <buffer> <Leader>osre <Plug>(omnisharp_restart_server)
  56. autocmd FileType cs nmap <silent> <buffer> <Leader>osst <Plug>(omnisharp_start_server)
  57. autocmd FileType cs nmap <silent> <buffer> <Leader>ossp <Plug>(omnisharp_stop_server)
  58. augroup END