function! InsertTabWrapper() let col = col('.')-1 if !col || getline('.')[col-1]!~'\k' return "\<tab>" else return "\<C-P>" endif endfunction inoremap <tab> <C-R>=InsertTabWrapper()<CR>
function! InsertTabWrapper() let col = col('.')-1 if !col || getline('.')[col-1]!~'\k' return "\<tab>" else return "\<C-P>" endif endfunction inoremap <tab> <C-R>=InsertTabWrapper()<CR>