From cb501a1ab76ca6206e4025d0b99c403fea13e31f Mon Sep 17 00:00:00 2001 From: Vasili Svirydau Date: Fri, 25 Oct 2019 17:58:26 -0700 Subject: [PATCH] wip --- coc-settings.json | 6 +++++ config/01-plugins.vim | 36 ++++++++++++++------------ config/02-general.vim | 5 ++-- config/03-mappings.vim | 57 ++++++++++++++++++++++++++++++++++-------- config/04-autocmds.vim | 39 ++++++++++++++++++++--------- 5 files changed, 102 insertions(+), 41 deletions(-) create mode 100644 coc-settings.json diff --git a/coc-settings.json b/coc-settings.json new file mode 100644 index 0000000..199efac --- /dev/null +++ b/coc-settings.json @@ -0,0 +1,6 @@ +{ + "coc.preferences.previewAutoClose": false, + "coc.preferences.hoverTarget": "echo", + "tsserver.log": "off", + "tsserver.trace.server":"off" +} diff --git a/config/01-plugins.vim b/config/01-plugins.vim index 84ae0c9..621f7ad 100644 --- a/config/01-plugins.vim +++ b/config/01-plugins.vim @@ -18,14 +18,14 @@ if(g:have_plug) Plug 'ctrlpvim/ctrlp.vim' " Fuzzy search Plug 'editorconfig/editorconfig-vim' " EditorConfig.org support - Plug 'ivyl/vim-bling' " blink search results + " Plug 'ivyl/vim-bling' " blink search results if executable('ag') Plug 'rking/ag.vim' " Silver Searcher Support endif if executable('rg') Plug 'jremmen/vim-ripgrep' " RipGrep endif - Plug 'tacahiroy/ctrlp-funky' " Fuzzy in-buffer search + " Plug 'tacahiroy/ctrlp-funky' " Fuzzy in-buffer search Plug 'tommcdo/vim-lion' " Align stuff Plug 'tpope/vim-abolish' " Case Convert and other stuff Plug 'tpope/vim-commentary' " Commenting @@ -44,17 +44,16 @@ if(g:have_plug) Plug 'mattn/emmet-vim' " ZenCoding Plug 'sheerun/vim-polyglot' " Language Support Bundle Plug 'ianks/vim-tsx' + Plug 'OrangeT/vim-csharp' " C# Support " Plug 'quramy/vim-js-pretty-template' " Syntax highlight inside template strings - " Plug 'quramy/tsuquyomi' " Language server support for TypeScript - " Plug 'heavenshell/vim-jsdoc' " Generate JSDoc comments " Quality of life " Plug 'edkolev/tmuxline.vim' - Plug 'jez/vim-superman' " Man page viewer - Plug 'mhinz/vim-signify' " Gutter signs, git, et al. + " Plug 'jez/vim-superman' " Man page viewer + " Plug 'mhinz/vim-signify' " Gutter signs, git, et al. " Plug 'sotte/presenting.vim' " Slides @@ -63,9 +62,10 @@ if(g:have_plug) Plug 'sbdchd/neoformat' " Automatic code formatting Plug 'neoclide/coc.nvim', {'branch': 'release'} - Plug 'OmniSharp/omnisharp-vim' - + Plug 'Shougo/deoplete.nvim' " Autocomplete Support Plug 'ruanyl/coverage.vim' " Code Coverage Support + Plug 'liuchengxu/vista.vim' " LSP Tagbar + Plug 'OmniSharp/omnisharp-vim' " .Net completion endif if stridx($SHELL, 'fish') >= 0 @@ -75,7 +75,7 @@ if(g:have_plug) call plug#end() if empty(glob(g:vim_files . '/plugged')) - PlugInstall + PlugInstall --sync endif endif @@ -83,7 +83,10 @@ let g:loaded_netrwPlugin = 1 " Disable netrw let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#ale#enabled = 1 +" let g:airline#extensions#ale#enabled = 0 +" let g:airline#extensions#coc#enabled = 1 +let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}' +let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}' let g:ale_sign_column_always = 1 let g:ale_sign_error = '' @@ -103,13 +106,14 @@ let g:coverage_sign_uncovered = '' let g:signify_vcs_list = [ 'git' ] -let g:LanguageClient_waitOutputTimeout = 1 -let g:LanguageClient_serverCommands = { - \ 'typescript': ['javascript-typescript-stdio'], - \ 'typescript.tsx': ['javascript-typescript-stdio'], - \ } +let g:neoformat_html_prettier = { + \ 'exe': 'prettier', + \ 'typescript': ['typescript-language-server', '--stdio'], + \ 'javascript': ['javascript-typescript-stdio'], + \ 'javascript.jsx': ['javascript-typescript-stdio'], + \ } -let g:deoplete#enable_at_startup = 1 +let g:neoformat_enabled_html = ['prettier'] let g:neoformat_nginx_nginxbeautifier = { \ 'exe': 'nginxbeautifier', diff --git a/config/02-general.vim b/config/02-general.vim index 7e83ed6..253356f 100644 --- a/config/02-general.vim +++ b/config/02-general.vim @@ -1,12 +1,13 @@ set encoding=utf-8 scriptencoding utf-8 -set shortmess=I " turn off splash screen +set shortmess=It " turn off splash screen, truncate status on buffer ops set hidden " enable multiple dirty buffers set modelines=0 set number " show line numbers set visualbell -set wildmode=full +set wildmenu +set wildmode=longest,list set background=dark silent! colorscheme hybrid " let mapleader = '\' "Set before any key remapping diff --git a/config/03-mappings.vim b/config/03-mappings.vim index a355ee1..139f74e 100644 --- a/config/03-mappings.vim +++ b/config/03-mappings.vim @@ -6,6 +6,9 @@ cmap w!! w !sudo tee % >/dev/null " cmap eh e %:h/ " cmap wh w %:h/ +" cmap %% %:h +cnoremap %% getcmdtype() == ':' ? expand('%:p:h') . '/' : '%%' +cnoremap %b getcmdtype() == ':' ? expand('%:p:r') : '%b' "Remove search highlight when is pressed nnoremap :nohlsearch @@ -22,17 +25,49 @@ noremap ] :bn noremap [ :bp noremap d :bd -nmap e[ (ale_previous_wrap) -nmap e] (ale_next_wrap) +" if exists('g:loaded_ale') + " nmap e[ (ale_previous_wrap) + " nmap e] (ale_next_wrap) -nmap p (ale_hover) -nmap D (ale_go_to_definition) -nmap U (ale_find_references) + " nmap p (ale_hover) + " nmap D (ale_go_to_definition) + " nmap U (ale_find_references) +" endif -" let g:ctrlp_funky_syntax_highlight = 1 -" nnoremap f :CtrlPFunky +" if exists('g:loaded_ctrlp_funky') + " let g:ctrlp_funky_syntax_highlight = 1 + " nnoremap f :CtrlPFunky +" endif -" nnoremap :call LanguageClient_contextMenu() -" nnoremap :call LanguageClient_textDocument_codeAction() -" nmap D :call LanguageClient_textDocument_definition() -" nmap p :call LanguageClient_textDocument_hover() +" if exists('g:LanguageClient_loaded') + " nnoremap :call LanguageClient_contextMenu() + " nnoremap :call LanguageClient_textDocument_codeAction() +" endif + +" coc.nvim +function! s:check_back_space() abort + let l:col = col('.') - 1 + return !l:col || getline('.')[l:col - 1] =~? '\s' +endfunction + +function! s:show_documentation() + if &filetype ==# 'vim' + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() + +nmap T (coc-type-definition) +nmap D (coc-definition) +nmap U (coc-references) +nmap I (coc-implemenetation) +nnoremap p :call show_documentation() +nmap e[ (coc-diagnostic-prev) +nmap e] (coc-diagnostic-next) +nnoremap :CocList commands diff --git a/config/04-autocmds.vim b/config/04-autocmds.vim index 0272e2b..36ec7a7 100644 --- a/config/04-autocmds.vim +++ b/config/04-autocmds.vim @@ -13,15 +13,17 @@ endfun augroup END - augroup CleanWhitespace - au! - autocmd BufWritePre * :call StripTrailingWhitespace() - function! StripTrailingWhitespace() - let l:pos = getpos('.') - %s/\s\+$//e - call setpos('.', l:pos) - endfun - augroup END + " augroup CleanWhitespace + " au! + " autocmd BufWritePre * :call StripTrailingWhitespace() + " function! StripTrailingWhitespace() + " let l:pos = getpos('.') + " let l:_s=@/ + " %s/\s\+$//e + " call setpos('.', l:pos) + " let @/=l:_s + " endfun + " augroup END augroup InsertTimer au! @@ -74,10 +76,18 @@ au BufNewFile,BufRead *.dockerfile setf dockerfile augroup END - augroup Svelte - au! - au BufNewFile,BufRead *.svelte setf html.svelte + augroup suffixes + autocmd! + let associations = [ + \["typescript", ".ts"], + \["typescript", "/index.ts"], + \["javascript", ".js"] + \] + + for ft in associations + execute "autocmd FileType " . ft[0] . " setlocal suffixesadd=" . ft[1] + endfor augroup END augroup Omnisharp @@ -89,4 +99,9 @@ autocmd FileType cs nnoremap :OmniSharpGetCodeActions augroup END + + augroup Signs + autocmd BufEnter * sign define dummy + autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('') + augroup end endif