vim:coc: Use tabs for indentation

This commit is contained in:
2022-10-21 02:01:02 +02:00
parent fc9f8f93ef
commit 2d27e598b6

View File

@@ -5,10 +5,6 @@
set nobackup set nobackup
set nowritebackup set nowritebackup
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Always show the signcolumn, otherwise it would shift the text each time " Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved. " diagnostics appear/become resolved.
set signcolumn=yes set signcolumn=yes
@@ -21,21 +17,21 @@ inoremap <silent><expr> <C-p> coc#pum#visible() ? coc#pum#prev(1) : "\<C-n>"
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by " NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config. " other plugin before putting this into your config.
inoremap <silent><expr> <TAB> inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1): \ coc#pum#visible() ? coc#pum#next(1):
\ CheckBackspace() ? "\<Tab>" : \ CheckBackspace() ? "\<Tab>" :
\ coc#refresh() \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
function! CheckBackspace() abort function! CheckBackspace() abort
let col = col('.') - 1 let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s' return !col || getline('.')[col - 1] =~# '\s'
endfunction endfunction
" Use <c-space> to trigger completion. " Use <c-space> to trigger completion.
if has('nvim') if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh() inoremap <silent><expr> <c-space> coc#refresh()
else else
inoremap <silent><expr> <c-@> coc#refresh() inoremap <silent><expr> <c-@> coc#refresh()
endif endif
" Make <CR> to accept selected completion item or notify coc.nvim to format " Make <CR> to accept selected completion item or notify coc.nvim to format
@@ -58,11 +54,11 @@ nmap <silent> gr <Plug>(coc-references)
nnoremap <silent> K :call ShowDocumentation()<CR> nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation() function! ShowDocumentation()
if CocAction('hasProvider', 'hover') if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover') call CocActionAsync('doHover')
else else
call feedkeys('K', 'in') call feedkeys('K', 'in')
endif endif
endfunction endfunction
" Highlight the symbol and its references when holding the cursor. " Highlight the symbol and its references when holding the cursor.
@@ -76,11 +72,11 @@ nmap <leader>rn <Plug>(coc-rename)
" nmap <leader>f <Plug>(coc-format-selected) " nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup augroup mygroup
autocmd! autocmd!
" Setup formatexpr specified filetype(s). " Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder. " Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end augroup end
" Applying codeAction to the selected region. " Applying codeAction to the selected region.
@@ -109,12 +105,12 @@ omap ao <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups. " Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750') if has('nvim-0.4.0') || 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-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>" 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-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>" 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-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>" vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif endif
" Use CTRL-S for selections ranges. " Use CTRL-S for selections ranges.