Omni-completion (aka "Intelisense") in vim using tab-key

Posted on October 27, 2006 in Vim

Just add this fine piece of code to your ~/.vimrc:

 function! CleverTab()
           if pumvisible()
             return "\"
           endif
   if strpart( getline('.'), 0, col('.')-1 ) =~ '^s*$'
      return "\"
           elseif exists('&omnifunc') && &omnifunc != ''
              return "\"
           else
              return "\"
          endif
endfunction
inoremap  =CleverTab()

Edit: Found a site which describes quite well how to enable the built in omnicompletion using ^X^O here.

^X^F completes filenames and directories.

Some other completion methods:

SnippetMagic:

Works for my but the arrow keys  are not correctly mapped so use better

snippetsEmu:

witch worked out of the box for me, just create  ~/.vim/after/ftplugin, open the vimball, source it with :so and use it with your tab-key.