diff options
author | Sergey Nazaryev <sergey@nazaryev.ru> | 2017-07-29 18:14:41 +0300 |
---|---|---|
committer | Sergey Nazaryev <sergey@nazaryev.ru> | 2017-07-29 18:14:41 +0300 |
commit | f901fa4fc3bb34c85f7f1f099a0fbf0c28840621 (patch) | |
tree | 73801c70e93f54882e10b60122600e15d243d587 /vimrc | |
parent | 7ff6229cc714abccda7008893e5d0c5d9aebbb22 (diff) | |
download | dotfiles-f901fa4fc3bb34c85f7f1f099a0fbf0c28840621.zip dotfiles-f901fa4fc3bb34c85f7f1f099a0fbf0c28840621.tar.gz dotfiles-f901fa4fc3bb34c85f7f1f099a0fbf0c28840621.tar.bz2 |
Add Tab for autocomplete, if neccessary
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -59,6 +59,16 @@ vnoremap < <gv vnoremap > >gv noremap <leader>ss :call StripTrailingWhitespace()<CR> +" Use Tab for autocomplete, if not at beginning of line +function! Tab_Or_Complete() + if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w' + return "\<C-N>" + else + return "\<Tab>" + endif +endfunction +inoremap <Tab> <C-R>=Tab_Or_Complete()<CR> + " Strip trailing whitespace (,ss) function! StripTrailingWhitespace() let save_cursor = getpos(".") |