commit 696acfe8873263c8484301fa69e23539abd4e66a
parent d5b9ba424126aa1fcf744fe4f629d1f3dce99662
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Fri, 27 Jul 2018 18:15:13 +0200
vim autocomplete tab mapping
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/vimrc b/vimrc
@@ -124,6 +124,8 @@ map q: <Nop>
" Custom mappings
nnoremap <leader>dif :Diff<cr>
nnoremap <leader>/ :noh<cr>
+inoremap <expr> <tab> InsertTabWrapper()
+inoremap <s-tab> <c-n>
" Custom commands
command Todo vimgrep /TODO\C/ **/*.* | copen
@@ -133,6 +135,15 @@ command CDC cd %:p:h
command Maketab set noet ts=2 | %retab!
command Diff w !diff % -
command Diffc w !git diff % -
+function! InsertTabWrapper()
+ let col = col('.') - 1
+ if !col || getline('.')[col - 1] !~ '\k'
+ return "\<tab>"
+ else
+ return "\<c-p>"
+ endif
+endfunction
+
" Retain visual mode after > and <
vmap < <gv