Untitled
public text v1 · immutablefunction InsertTabWrapper(direction)
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
elseif "backward" == a:direction
return "\<c-p>"
else
return "\<c-n>"
endif
endfunction
inoremap <Tab> <c-r>=InsertTabWrapper("forward")<cr>
inoremap <S-Tab> <c-r>=InsertTabWrapper("backward")<cr>