All pastes #23354 Raw Edit

Untitled

public text v1 · immutable
#23354 ·published 2005-09-19 15:57 UTC
rendered paste body
function 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>