aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/nvim/init.vim11
-rw-r--r--.vimrc12
2 files changed, 23 insertions, 0 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 097a010..6fbd858 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -116,3 +116,14 @@ set ttimeout
set ttimeoutlen=1
set listchars=tab:>-,trail:~,extends:>,precedes:<,space:.
set ttyfast
+
+" Tab Autocompletion for COC NVIM
+function! CheckBackspace() abort
+ let col = col('.') - 1
+ return !col || getline('.')[col - 1] =~# '\s'
+endfunction
+
+inoremap <silent><expr> <TAB>
+ \ coc#pum#visible() ? coc#pum#next(1) :
+ \ CheckBackspace() ? "\<Tab>" :
+ \ coc#refresh()
diff --git a/.vimrc b/.vimrc
index 097a010..f949d35 100644
--- a/.vimrc
+++ b/.vimrc
@@ -116,3 +116,15 @@ set ttimeout
set ttimeoutlen=1
set listchars=tab:>-,trail:~,extends:>,precedes:<,space:.
set ttyfast
+
+" Tab Autocompletion for COC NVIM
+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()
+