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
When you're choosing a file to open in vi(m), you can limit your search to a mask:
:e *.pl[tab]
At this point you're only tab'ing through the .pl files.
vivim
If you would like to have syntax highlighting on a file that would otherwise not have any highlighting at all, you can symlink the file to the appropriate extension and open it:
$ ln -s example.lxp example.html $ vi example.html # opened with pretty highlighting
*Note: This should be used sparingly and you should clean up your symlinks.
commandseditorshighlightingshellsymlinksyntaxvi