Only load coc.nvim when compatible

This commit is contained in:
Anthony Rose 2020-10-30 14:05:33 +00:00
parent 585a23a946
commit 9872e15a7f
24 changed files with 20 additions and 19 deletions

39
vimrc
View file

@ -47,7 +47,6 @@ set autoindent
set autoread set autoread
set background=dark set background=dark
set backspace=indent,eol,start set backspace=indent,eol,start
set cmdheight=2
set colorcolumn=101 set colorcolumn=101
set directory=$TEMP//,/tmp//,. set directory=$TEMP//,/tmp//,.
set display+=lastline set display+=lastline
@ -118,24 +117,6 @@ if has("eval")
set t_Co=16 set t_Co=16
endif endif
colorscheme PaperColor colorscheme PaperColor
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
endif endif
"============================================================================= "=============================================================================
@ -180,6 +161,26 @@ else
set signcolumn=yes set signcolumn=yes
endif endif
if has("patch-8.1.1719") && executable("nodejs")
packadd coc.nvim
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
endif
if has("printer") if has("printer")
set printheader=%t%h%m%=Page\ %N set printheader=%t%h%m%=Page\ %N
set printoptions=paper:A4,number:y,syntax:n set printoptions=paper:A4,number:y,syntax:n