Skip to content

Instantly share code, notes, and snippets.

@fannheyward
Created January 6, 2022 03:43
Show Gist options
  • Save fannheyward/d8faa8ef3d40dd2c865bc0d7cf04c3ba to your computer and use it in GitHub Desktop.
Save fannheyward/d8faa8ef3d40dd2c865bc0d7cf04c3ba to your computer and use it in GitHub Desktop.
set nocompatible
set runtimepath^=~/.config/nvim/plugged/coc.nvim
filetype plugin indent on
syntax on
set hidden
set runtimepath^=~/src/coc-clangd
"Completion settings
"Use complete_info() if you need confirm completion only when there's selected complete item
if exists('*complete_info')
inoremap <silent><expr> <cr> complete_info(['selected'])['selected'] != -1 ? "\<C-y>" : "\<C-g>u\<CR>"
endif
"Use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment