Skip to content

Instantly share code, notes, and snippets.

@zbyna
Created November 11, 2021 01:40
Show Gist options
  • Save zbyna/d8d8106dd7dddf227406249e3df25cc2 to your computer and use it in GitHub Desktop.
Save zbyna/d8d8106dd7dddf227406249e3df25cc2 to your computer and use it in GitHub Desktop.
c# (omnisharp,firenvim ) neovim coding for Exercism.org in browser (Firefox)
call plug#begin(stdpath('data').'/plugged')
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'dense-analysis/ale'
Plug 'OmniSharp/omnisharp-vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'tpope/vim-commentary' "comment-out by gc
Plug 'vim-airline/vim-airline' " make statusline awesome
Plug 'vim-airline/vim-airline-themes' " themes for statusline
Plug 'ncm2/float-preview.nvim'
call plug#end()
" Classic_VIM_Configuration: {{{
" Don't autoselect first omnicomplete option, show options even if there is
" only
" one (so the preview documentation is accessible). Remove 'preview' if you
" don't want to see any documentation whatsoever.
" set completeopt=longest,menuone,preview
" set completepopup=highlight:Pmenu,border:off
" Set desired preview window height for viewing documentation.
" set previewpopup=height:10,width:60
" You might also want to look at the echodoc plugin.
colors zenburn
set number " always show current line number
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set hlsearch " highlight search and search while typing
set incsearch
set cpoptions+=x " stay at seach item when <esc>
nnoremap <CR> :nohlsearch<CR><CR>
set mouse=a
set previewheight=5
" Better nav for omnicomplete
inoremap <expr> <c-j> ("\<C-n>")
inoremap <expr> <c-k> ("\<C-p>")
" }}}
" Float: {{{
let g:float_preview#docked = 0
" }}}
" FIRENVIM: {{{
if exists('g:started_by_firenvim')
colorscheme zenburn
endif
let g:firenvim_config = {
\ 'localSettings': {
\ 'https?://exercism.org.*': {
\ 'filename': '/home/zbyna/Projekty/csharp-exercism/{hostname}_{pathname%10}.cs',
\ },
\ 'https?://github.com.*': {
\ 'filename': '/tmp/{hostname}_{pathname%10}.markdown',
\ },
\ }
\ }
function Create_csproj()
" silent !/home/zbyna/Projekty/csharp-vstudiocode/vytvareni_csproj/createcsproj.sh
" !sleep 10 - ani sleep nepomáhá, prostě je potřeba restartovat nvim no :-)
set filetype=cs
endfunction
au BufEnter exercism.org_*.cs call Create_csproj()
au BufEnter github.com_*.markdown set filetype=markdown
" }}}
" ALE: {{{
let g:ale_sign_error = '•'
let g:ale_sign_warning = '•'
let g:ale_sign_info = '·'
let g:ale_sign_style_error = '·'
let g:ale_sign_style_warning = '·'
let g:ale_linters = { 'cs': ['OmniSharp'] }
" }}}
" Asyncomplete: {{{
let g:asyncomplete_auto_popup = 1
let g:asyncomplete_auto_completeopt = 1
" }}}
" OMNISHARP: {{{
"let g:OmniSharp_loglevel = 'debug'
let g:OmniSharp_popup = 1
let g:OmniSharp_popup_position = 'atcursor'
let g:OmniSharp_popup_options = {
\ 'winhl': 'Normal:NormalFloat'
\}
let g:OmniSharp_typeLookupInPreview = 1
let g:omnicomplete_fetch_full_documentation = 1
" Timeout in seconds to wait for a response from the server
let g:OmniSharp_timeout = 5
" Use fzf
let g:OmniSharp_selector_ui = 'fzf'
let g:OmniSharp_selector_findusages = 'fzf'
" Update semantic highlighting on BufEnter and InsertLeave
let g:OmniSharp_highlight_types = 2
augroup omnisharp_commands
autocmd!
" Show type information automatically when the cursor stops moving
autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation()
" The following commands are contextual, based on the cursor position.
autocmd FileType cs nnoremap <buffer> gd :OmniSharpGotoDefinition<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fi :OmniSharpFindImplementations<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fs :OmniSharpFindSymbol<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fu :OmniSharpFindUsages<CR>
" Finds members in the current buffer
autocmd FileType cs nnoremap <buffer> <Leader>fm :OmniSharpFindMembers<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fx :OmniSharpFixUsings<CR>
autocmd FileType cs nnoremap <buffer> <Leader>tt :OmniSharpTypeLookup<CR>
autocmd FileType cs nnoremap <buffer> <Leader>dc :OmniSharpDocumentation<CR>
autocmd FileType cs nnoremap <buffer> <C-\> :OmniSharpSignatureHelp<CR>
autocmd FileType cs inoremap <buffer> <C-\> <C-o>:OmniSharpSignatureHelp<CR>
" Navigate up and down by method/property/field
autocmd FileType cs nnoremap <buffer> <C-k> :OmniSharpNavigateUp<CR>
autocmd FileType cs nnoremap <buffer> <C-j> :OmniSharpNavigateDown<CR>
" Find all code errors/warnings for the current solution and populate the quickfix window
autocmd FileType cs nnoremap <buffer> <Leader>cc :OmniSharpGlobalCodeCheck<CR>
augroup END
" Contextual code actions (uses fzf, CtrlP or unite.vim when available)
nnoremap <Leader><Space> :OmniSharpGetCodeActions<CR>
" Run code actions with text selected in visual mode to extract method
xnoremap <Leader><Space> :call OmniSharpGetCodeActions('visual')<CR>
" Rename with dialog
nnoremap <Leader>nm :OmniSharpRename<CR>
nnoremap <F2> :OmniSharpRename<CR>
" Rename without dialog - with cursor on the symbol to rename: `:Rename newname`
command! -nargs=1 Rename :call OmniSharp#RenameTo("<args>")
nnoremap <Leader>cf :OmniSharpCodeFormat<CR>
"}}}
" AIRLINE: {{{
let g:airline_powerline_fonts = 1
let g:airline_section_y = ""
let g:airline#extensions#tabline#enabled = 1
" do not show error/warning section
let g:airline_section_error = ""
let g:airline_section_warning = ""
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_theme='zenburn'
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment