parsed.org

Tips by tag: settings

Autocompletion in VIM using TAB by oozy on Apr 25, 2007 03:54 AM

Put this into ~/.vimrc:

fun! InsertTabWrapper()
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k'
       return "\<tab>"
    else
       return "\<c-p>"
    endif
endfun

fun! ShiftInsertTabWrapper()
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k'
       return "\<s-tab>"
    else
       return "\<c-n>"
    endif
endfun

inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <s-tab> <c-r>=ShiftInsertTabWrapper()<cr>

:set dictionary+=dict.file
:set dictionary+=%
:set iskeyword+=:
:set complete+=k
autocompletionconfigurationeditorssettingsvivimvimrc
RSS