More refactoring, leveraging after/ftplugin
This commit is contained in:
14
after/ftplugin/cs.vim
Normal file
14
after/ftplugin/cs.vim
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
let g:OmniSharp_selector_ui = 'ctrlp'
|
||||||
|
let g:OmniSharp_highlight_groups = {
|
||||||
|
\ 'csUserIdentifier': [
|
||||||
|
\ 'constant name', 'enum member name', 'field name', 'identifier',
|
||||||
|
\ 'local name', 'parameter name', 'property name', 'static symbol'],
|
||||||
|
\ 'csUserInterface': ['interface name'],
|
||||||
|
\ 'csUserMethod': ['extension method name', 'method name'],
|
||||||
|
\ 'csUserType': ['class name', 'enum name', 'namespace name', 'struct name']
|
||||||
|
\}
|
||||||
|
let g:OmniSharp_highlight_types = 2
|
||||||
|
|
||||||
|
nnoremap <buffer> <leader>D :OmniSharpGotoDefinition<CR>
|
||||||
|
nnoremap <buffer> <leader>cc :OmniSharpGlobalCodeCheck<CR>
|
||||||
|
nnoremap <buffer> <F12> :OmniSharpGetCodeActions<CR>
|
||||||
2
after/ftplugin/javascript.vim
Normal file
2
after/ftplugin/javascript.vim
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
setlocal suffixesadd='.js'
|
||||||
|
setlocal ai sw=2 sts=2 et
|
||||||
2
after/ftplugin/typescript.vim
Normal file
2
after/ftplugin/typescript.vim
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
setlocal suffixesadd='.ts'
|
||||||
|
setlocal suffixesadd='/index.ts'
|
||||||
@@ -2,16 +2,16 @@ set encoding=utf-8
|
|||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
|
|
||||||
let s:plug_path=expand($MYVIM . '/autoload/plug.vim')
|
let s:plug_path=expand($MYVIM . '/autoload/plug.vim')
|
||||||
let g:have_plug=filereadable(s:plug_path)
|
let s:have_plug=filereadable(s:plug_path)
|
||||||
if(!g:have_plug && executable('curl'))
|
if(!s:have_plug && executable('curl'))
|
||||||
echo 'Installing Plug'
|
echo 'Installing Plug'
|
||||||
|
|
||||||
execute '!curl -fLo "' . s:plug_path . '" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
execute '!curl -fLo "' . s:plug_path . '" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
execute 'source ' . s:plug_path
|
execute 'source ' . s:plug_path
|
||||||
let g:have_plug = 1
|
let s:have_plug = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if(g:have_plug)
|
if(s:have_plug)
|
||||||
let s:plugged=resolve($MYVIM . '/.cache/plugged')
|
let s:plugged=resolve($MYVIM . '/.cache/plugged')
|
||||||
call plug#begin(s:plugged)
|
call plug#begin(s:plugged)
|
||||||
|
|
||||||
@@ -39,10 +39,9 @@ if(g:have_plug)
|
|||||||
Plug 'mattn/emmet-vim' " ZenCoding
|
Plug 'mattn/emmet-vim' " ZenCoding
|
||||||
Plug 'sheerun/vim-polyglot' " Language Support Bundle
|
Plug 'sheerun/vim-polyglot' " Language Support Bundle
|
||||||
Plug 'ianks/vim-tsx'
|
Plug 'ianks/vim-tsx'
|
||||||
Plug 'OrangeT/vim-csharp' " C# Support
|
" Plug 'OrangeT/vim-csharp' " C# Support
|
||||||
|
|
||||||
|
Plug 'mhinz/vim-signify' " Gutter signs, git, et al.
|
||||||
" Plug 'mhinz/vim-signify' " Gutter signs, git, et al.
|
|
||||||
" Plug 'sotte/presenting.vim' " Slides
|
" Plug 'sotte/presenting.vim' " Slides
|
||||||
|
|
||||||
if v:version >= 800
|
if v:version >= 800
|
||||||
@@ -51,8 +50,11 @@ if(g:have_plug)
|
|||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
Plug 'Shougo/deoplete.nvim' " Autocomplete Support
|
Plug 'Shougo/deoplete.nvim' " Autocomplete Support
|
||||||
Plug 'ruanyl/coverage.vim' " Code Coverage Support
|
Plug 'ruanyl/coverage.vim' " Code Coverage Support
|
||||||
Plug 'liuchengxu/vista.vim' " LSP Tagbar
|
if executable('ctags')
|
||||||
|
Plug 'liuchengxu/vista.vim' " LSP Tagbar
|
||||||
|
endif
|
||||||
Plug 'OmniSharp/omnisharp-vim' " .Net completion
|
Plug 'OmniSharp/omnisharp-vim' " .Net completion
|
||||||
|
Plug 'nickspoons/vim-sharpenup' " OmniSharp Helpers
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if stridx($SHELL, 'fish') >= 0
|
if stridx($SHELL, 'fish') >= 0
|
||||||
@@ -83,40 +85,3 @@ let g:signify_vcs_list = [ 'git' ]
|
|||||||
|
|
||||||
let g:neoformat_enabled_html = ['prettier']
|
let g:neoformat_enabled_html = ['prettier']
|
||||||
let g:neoformat_enabled_nginx = ['nginxbeautifier']
|
let g:neoformat_enabled_nginx = ['nginxbeautifier']
|
||||||
|
|
||||||
let g:OmniSharp_server_stdio = 1
|
|
||||||
let g:OmniSharp_selector_ui = 'ctrlp'
|
|
||||||
let g:OmniSharp_highlight_groups = {
|
|
||||||
\ 'csUserIdentifier': [
|
|
||||||
\ 'constant name', 'enum member name', 'field name', 'identifier',
|
|
||||||
\ 'local name', 'parameter name', 'property name', 'static symbol'],
|
|
||||||
\ 'csUserInterface': ['interface name'],
|
|
||||||
\ 'csUserMethod': ['extension method name', 'method name'],
|
|
||||||
\ 'csUserType': ['class name', 'enum name', 'namespace name', 'struct name']
|
|
||||||
\}
|
|
||||||
let g:OmniSharp_highlight_types = 2
|
|
||||||
|
|
||||||
sign define OmniSharpCodeActions text=💡
|
|
||||||
augroup OSCountCodeActions
|
|
||||||
autocmd!
|
|
||||||
autocmd FileType cs set signcolumn=yes
|
|
||||||
autocmd CursorHold *.cs call OSCountCodeActions()
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
function! OSCountCodeActions() abort
|
|
||||||
if bufname('%') ==# '' || OmniSharp#FugitiveCheck() | return | endif
|
|
||||||
if !OmniSharp#IsServerRunning() | return | endif
|
|
||||||
let l:opts = {
|
|
||||||
\ 'CallbackCount': function('s:CBReturnCount'),
|
|
||||||
\ 'CallbackCleanup': {-> execute('sign unplace 99')}
|
|
||||||
\}
|
|
||||||
call OmniSharp#CountCodeActions(l:opts)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:CBReturnCount(count) abort
|
|
||||||
if a:count
|
|
||||||
let l:l = getpos('.')[1]
|
|
||||||
let l:f = expand('%:p')
|
|
||||||
execute ':sign place 99 line='.l:l.' name=OmniSharpCodeActions file='.l:f
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ noremap <silent><leader>w :update<cr>
|
|||||||
inoremap <silent><leader>w <Esc>:update<cr>a
|
inoremap <silent><leader>w <Esc>:update<cr>a
|
||||||
cmap w!! w !sudo tee % >/dev/null
|
cmap w!! w !sudo tee % >/dev/null
|
||||||
|
|
||||||
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:p:h') . '/' : '%%'
|
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:p:h') . '\' : '%%'
|
||||||
cnoremap <expr> %b getcmdtype() == ':' ? expand('%:p:r') : '%b'
|
cnoremap <expr> %b getcmdtype() == ':' ? expand('%:p:r') : '%b'
|
||||||
|
|
||||||
"Remove search highlight when <Esc> is pressed
|
"Remove search highlight when <Esc> is pressed
|
||||||
|
|||||||
@@ -1,88 +1,52 @@
|
|||||||
if has('autocmd')
|
if !has('autocmd')
|
||||||
filetype plugin indent on
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
augroup InvisibleCharsHighlight
|
filetype plugin indent on
|
||||||
au!
|
|
||||||
|
|
||||||
autocmd ColorScheme * :call ResetColors()
|
augroup InvisibleCharsHighlight
|
||||||
|
au!
|
||||||
|
|
||||||
function! ResetColors()
|
autocmd ColorScheme * :call ResetColors()
|
||||||
"Invisible character colors
|
|
||||||
highlight NonText guifg=#4a4a59
|
|
||||||
highlight SpecialKey guifg=#4a4a59
|
|
||||||
endfun
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup InsertTimer
|
function! ResetColors()
|
||||||
au!
|
"Invisible character colors
|
||||||
"Autoexit to normal mode after 15 seconds of inactivity
|
highlight NonText guifg=#4a4a59
|
||||||
autocmd CursorHoldI * stopinsert
|
highlight SpecialKey guifg=#4a4a59
|
||||||
autocmd InsertEnter * let updaterestore=&updatetime | set updatetime=15000
|
endfun
|
||||||
autocmd InsertLeave * let &updatetime=updaterestore
|
augroup END
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup vimrc
|
augroup InsertTimer
|
||||||
"Automatically reload VIMRC file after saving
|
au!
|
||||||
au!
|
"Autoexit to normal mode after 15 seconds of inactivity
|
||||||
autocmd bufwritepost $MYVIMRC source $MYVIMRC
|
autocmd CursorHoldI * stopinsert
|
||||||
if (exists('g:loaded_airline') && g:loaded_airline)
|
autocmd InsertEnter * let updaterestore=&updatetime | set updatetime=15000
|
||||||
autocmd bufwritepost $MYVIMRC AirlineRefresh
|
autocmd InsertLeave * let &updatetime=updaterestore
|
||||||
endif
|
augroup END
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup diffmode
|
augroup vimrc
|
||||||
au!
|
"Automatically reload VIMRC file after saving
|
||||||
" Mappings for diff mode
|
au!
|
||||||
autocmd filterwritepre * if &diff | map <leader>{ :diffget LOCAL<cr>| endif
|
autocmd bufwritepost $MYVIMRC source $MYVIMRC
|
||||||
autocmd filterwritepre * if &diff | map <leader>\| :diffget BASE<cr>| endif
|
if (exists('g:loaded_airline') && g:loaded_airline)
|
||||||
autocmd filterwritepre * if &diff | map <leader>} :diffget REMOTE<cr>| endif
|
autocmd bufwritepost $MYVIMRC AirlineRefresh
|
||||||
augroup END
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup javascript
|
augroup diffmode
|
||||||
"Custom mappings
|
au!
|
||||||
au!
|
" Mappings for diff mode
|
||||||
autocmd FileType javascript set ai sw=2 sts=2 et
|
autocmd filterwritepre * if &diff | map <leader>{ :diffget LOCAL<cr>| endif
|
||||||
|
autocmd filterwritepre * if &diff | map <leader>\| :diffget BASE<cr>| endif
|
||||||
|
autocmd filterwritepre * if &diff | map <leader>} :diffget REMOTE<cr>| endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup END
|
augroup Dockerfile
|
||||||
|
au!
|
||||||
|
au BufNewFile,BufRead *.dockerfile setf dockerfile
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup typescript
|
augroup Signs
|
||||||
au!
|
autocmd BufEnter * sign define dummy
|
||||||
augroup END
|
autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
|
||||||
|
augroup end
|
||||||
augroup Dockerfile
|
|
||||||
au!
|
|
||||||
au BufNewFile,BufRead *.dockerfile setf dockerfile
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup suffixes
|
|
||||||
autocmd!
|
|
||||||
|
|
||||||
let g:associations = [
|
|
||||||
\['typescript', '.ts'],
|
|
||||||
\['typescript', '/index.ts'],
|
|
||||||
\['javascript', '.js']
|
|
||||||
\]
|
|
||||||
|
|
||||||
for g:ft in g:associations
|
|
||||||
execute 'autocmd FileType ' . g:ft[0] . ' setlocal suffixesadd=' . g:ft[1]
|
|
||||||
endfor
|
|
||||||
|
|
||||||
unlet g:associations
|
|
||||||
unlet g:ft
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup Omnisharp
|
|
||||||
au!
|
|
||||||
autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation()
|
|
||||||
|
|
||||||
autocmd FileType cs nnoremap <buffer> <leader>D :OmniSharpGotoDefinition<CR>
|
|
||||||
autocmd FileType cs nnoremap <buffer> <Leader>cc :OmniSharpGlobalCodeCheck<CR>
|
|
||||||
autocmd FileType cs nnoremap <F12> :OmniSharpGetCodeActions<CR>
|
|
||||||
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup Signs
|
|
||||||
autocmd BufEnter * sign define dummy
|
|
||||||
autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
|
|
||||||
augroup end
|
|
||||||
endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user