in reply to (OT) tab completion for code?

If you don't want to do omnicompletion or don't have the latest vim, try adding this to your .vimrc instead.
function! TabOrCompletion() let col = col('.') - 1 if col==0 || getline('.')[col - 1] !~ '\k' return "\<TAB>" else return "\<C-N>" endif endfunction inoremap <tab> <c-r>=TabOrCompletion()<cr>