" whether to use a popup menu for Insert mode completion
set completeopt=longest,menuone,preview
+" Indent if we're at the beginning of a line. Else, do completion.
+function! InsertTabWrapper()
+ let col = col('.') - 1
+ if !col || getline('.')[col - 1] !~ '\k'
+ return "\<Tab>"
+ else
+ return "\<C-N>"
+endif
+endfunction
+inoremap <Tab> <C-R>=InsertTabWrapper()<CR>
+inoremap <S-Tab> <C-P>
+
" fix legacy vi inconsistency
map Y y$
set backup " keep a backup after owerwriting a file
set backupdir=$HOME/.vim/backupdir
-set undofile " persistent undo history
+set undofile " persistent undo history
set undodir=$HOME/.vim/backupdir
set autowrite " automatically write a file when leaving a modified buffer
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
-