Download omniperl Vim pluginn :
http://www.vim.org/scripts/script.php?script_id=1924
goto your Vim's runtime directory :
Ex: ~/.vim
extract omniperl.zip there then open omniperl.vba with vim :
$cd ~/.vim
$unzip omniperl.zip
$vim omniperl.vba
they type :so %
(so that it will extracts required files from vba file
*Note: if you got any errors try to install vimball plug in before doing above step
http://www.vim.org/scripts/script.php?script_id=1502
follow instructions in 'install details section
)
open your .vimrc file and put below lines :
"===================================
filetype plugin on
autocmd FileType pl set omnifunc=perlcomplete#OmniPerl_Complete
function! SmartComplete ()
" Remember where we parked...
let cursorpos = getpos('.')
let cursorcol = cursorpos[2]
let curr_line = getline('.')
" Special subpattern to match only at cursor position...
let curr_pos_pat = '\%' . cursorcol . 'c'
" Tab as usual at the left margin...
if curr_line =~ '^\s*' . curr_pos_pat
return "\<TAB>"
endif
" If no contextual match and after an identifier, do keyword completion...
if curr_line =~ '\k' . curr_pos_pat
return "\<C-N>"
" Otherwise, just be a ...
endif
if curr_line =~ '\(\->\|::\)' . curr_pos_pat
return "\<C-X>\<C-O>"
else
return "\<TAB>"
endif
endfunction
" Remap for smart completion on various characters...
inoremap =SmartComplete()
"===================================
you are done with it !!
now you can test it , open a new perl file :
$vim test.pl
now type below :
use DBI;
DBI->
pressing tab after typing DBI-> will popup methods of that module.
Damn good isn't it???
Happy Vimming !!