-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from voidekh/next
Dropping Neovim support
- Loading branch information
Showing
14 changed files
with
328 additions
and
936 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
" _____ _ _ ___ ____ | ||
" / ___/(_)___ _____ ___ ____ | | / (_)___ ___ / __ \_____ | ||
" \__ \/ / __ `/ __ `__ \/ __ `/ | / / / __ `__ \/ /_/ / ___/ | ||
" ___/ / / /_/ / / / / / / /_/ /| |/ / / / / / / / _, _/ /__ | ||
" /____/_/\__, /_/ /_/ /_/\__,_/ |___/_/_/ /_/ /_/_/ |_|\___/ | ||
" /____/ | ||
" autoload/sigma/coc/line.vim | ||
" SigmaVimRc CoC line | ||
" Derived from: https://github.com/josa42/vim-lightline-coc/blob/master/autoload/lightline/coc.vim | ||
|
||
let s:indicator = { | ||
\ 'error': get(g:, 'sigma#coc#line#indicator_errors', ' '), | ||
\ 'warning': get(g:, 'sigma#coc#line#indicator_warnings', ' '), | ||
\ 'hint': get(g:, 'sigma#coc#line#indicator_hints', ' '), | ||
\ 'info': get(g:, 'sigma#coc#line#indicator_info', ' ') | ||
\ } | ||
|
||
function! sigma#coc#line#errors() | ||
return s:get_coc('error') | ||
endfunction | ||
|
||
function! sigma#coc#line#warnings() | ||
return s:get_coc('warning') | ||
endfunction | ||
|
||
function! sigma#coc#line#hints() | ||
return s:get_coc('hint') | ||
endfunction | ||
|
||
function! sigma#coc#line#infos() | ||
return s:get_coc('info') | ||
endfunction | ||
|
||
function! sigma#coc#line#status() | ||
return get(g:, 'coc_status', '') | ||
endfunction | ||
|
||
function! sigma#coc#line#register() abort | ||
call s:setLightline('component_expand', 'coc_status', 'sigma#coc#line#status') | ||
call s:setLightline('component_expand', 'coc_errors', 'sigma#coc#line#errors') | ||
call s:setLightline('component_expand', 'coc_warnings', 'sigma#coc#line#warnings') | ||
call s:setLightline('component_expand', 'coc_infos', 'sigma#coc#line#infos') | ||
call s:setLightline('component_expand', 'coc_hints', 'sigma#coc#line#hints') | ||
|
||
call s:setLightline('component_type', 'coc_warnings', 'warning') | ||
call s:setLightline('component_type', 'coc_errors', 'error') | ||
call s:setLightline('component_type', 'coc_infos', 'info') | ||
call s:setLightline('component_type', 'coc_hints', 'hint') | ||
|
||
call s:setLightline('component_function', 'coc_status', 'sigma#coc#line#status') | ||
|
||
augroup sigma#coc#line | ||
autocmd! | ||
autocmd User CocDiagnosticChange call lightline#update() | ||
autocmd User CocStatusChange call lightline#update() | ||
augroup END | ||
endfunction | ||
|
||
function! s:get_coc(type) abort | ||
if s:isHidden() | ||
return 0 | ||
endif | ||
|
||
let info = get(b:, 'coc_diagnostic_info', {}) | ||
let coc_count = get(info, a:type, 0) | ||
return coc_count == 0 ? '' : printf(s:indicator[a:type] . '%d', coc_count) | ||
endfunction | ||
|
||
function! s:isHidden() | ||
return exists('*lightline#sensible#isHidden') && lightline#sensible#isHidden() | ||
endfunction | ||
|
||
function! s:setLightline(scope, name, value) abort | ||
let g:lightline = get(g:, 'lightline', {}) | ||
let g:lightline[a:scope] = get(g:lightline, a:scope, {}) | ||
let g:lightline[a:scope][a:name] = get(g:lightline[a:scope], a:name, a:value) | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
" _____ _ _ ___ ____ | ||
" / ___/(_)___ _____ ___ ____ | | / (_)___ ___ / __ \_____ | ||
" \__ \/ / __ `/ __ `__ \/ __ `/ | / / / __ `__ \/ /_/ / ___/ | ||
" ___/ / / /_/ / / / / / / /_/ /| |/ / / / / / / / _, _/ /__ | ||
" /____/_/\__, /_/ /_/ /_/\__,_/ |___/_/_/ /_/ /_/_/ |_|\___/ | ||
" /____/ | ||
" autoload/sigma/coc/lsp.vim | ||
" SigmaVimRc CoC LSP | ||
|
||
function! sigma#coc#lsp#init() | ||
set encoding=utf-8 | ||
set nobackup | ||
set nowritebackup | ||
set updatetime=300 | ||
set signcolumn=yes | ||
|
||
augroup mygroup | ||
autocmd! | ||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | ||
augroup end | ||
|
||
autocmd CursorHold * silent call CocActionAsync('highlight') | ||
|
||
command! -nargs=0 Format :call CocActionAsync('format') | ||
command! -nargs=? Fold :call CocAction('fold', <f-args>) | ||
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') | ||
endfunction | ||
|
||
function! sigma#coc#lsp#show_documentation() | ||
if CocAction('hasProvider', 'hover') | ||
call CocActionAsync('doHover') | ||
else | ||
call feedkeys('K', 'in') | ||
endif | ||
endfunction | ||
|
||
function! sigma#coc#lsp#check_backspace() abort | ||
let col = col('.') - 1 | ||
return !col || getline('.')[col - 1] =~# '\s' | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
function! sigma#coc#mappings#init() | ||
inoremap <silent><expr> <TAB> | ||
\ coc#pum#visible() ? coc#pum#next(1) : | ||
\ sigma#coc#lsp#check_backspace() ? "\<Tab>" : | ||
\ coc#refresh() | ||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" | ||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() | ||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | ||
inoremap <silent><expr> <c-@> coc#refresh() | ||
nmap <silent> [d <Plug>(coc-diagnostic-prev) | ||
nmap <silent> ]d <Plug>(coc-diagnostic-next) | ||
nmap <silent> gd <Plug>(coc-definition) | ||
nmap <silent> gD <Plug>(coc-type-definition) | ||
nmap <silent> gi <Plug>(coc-implementation) | ||
nmap <silent> gr <Plug>(coc-references) | ||
nnoremap <silent> K :call sigma#coc#lsp#show_documentation()<CR> | ||
nmap <leader>rn <Plug>(coc-rename) | ||
xmap <leader>f <Plug>(coc-format-selected) | ||
nmap <leader>f <Plug>(coc-format-selected) | ||
xmap <leader>a <Plug>(coc-codeaction-selected) | ||
nmap <leader>a <Plug>(coc-codeaction-selected) | ||
nmap <leader>ca <Plug>(coc-codeaction-cursor) | ||
nmap <leader>cb <Plug>(coc-codeaction-source) | ||
nmap <leader>qf <Plug>(coc-fix-current) | ||
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor) | ||
xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected) | ||
nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected) | ||
nmap <leader>cl <Plug>(coc-codelens-action) | ||
xmap if <Plug>(coc-funcobj-i) | ||
omap if <Plug>(coc-funcobj-i) | ||
xmap af <Plug>(coc-funcobj-a) | ||
omap af <Plug>(coc-funcobj-a) | ||
xmap ic <Plug>(coc-classobj-i) | ||
omap ic <Plug>(coc-classobj-i) | ||
xmap ac <Plug>(coc-classobj-a) | ||
omap ac <Plug>(coc-classobj-a) | ||
if has('patch-8.2.0750') | ||
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | ||
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | ||
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>" | ||
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>" | ||
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | ||
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | ||
endif | ||
|
||
nmap <silent> <C-s> <Plug>(coc-range-select) | ||
xmap <silent> <C-s> <Plug>(coc-range-select) | ||
endfunction |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.