What are your suggestions for an ideal Vim configuration for Perl development?

后端 未结 12 1211
说谎
说谎 2021-01-29 17:56

There are a lot of threads pertaining to how to configure Vim/GVim for Perl development on PerlMonks.org. My purpose in posting this question is to try to create, as much as pos

12条回答
  •  渐次进展
    2021-01-29 18:27

    I have 2.

    The first one I know I picked up part of it from someone else, but I can't remember who. Sorry unknown person. Here's how I made "C^N" auto complete work with Perl. Here's my .vimrc commands.

    " to use CTRL+N with modules for autocomplete "
    set iskeyword+=:
    set complete+=k~/.vim_extras/installed_modules.dat
    

    Then I set up a cron to create the installed_modules.dat file. Mine is for my mandriva system. Adjust accordingly.

    locate *.pm | grep "perl5" | sed -e "s/\/usr\/lib\/perl5\///" | sed -e "s/5.8.8\///" | sed -e "s/5.8.7\///" | sed -e "s/vendor_perl\///" | sed -e "s/site_perl\///" | sed -e "s/x86_64-linux\///" | sed -e "s/\//::/g" | sed -e "s/\.pm//" >/home/jeremy/.vim_extras/installed_modules.dat
    

    The second one allows me to use gf in Perl. Gf is a shortcut to other files. just place your cursor over the file and type gf and it will open that file.

    " To use gf with perl "
    set path+=$PWD/**,
    set path +=/usr/lib/perl5/*,
    set path+=/CompanyCode/*,   " directory containing work code "
    autocmd BufRead *.p? set include=^use
    autocmd BufRead *.pl set includeexpr=substitute(v:fname,'\\(.*\\)','\\1.pm','i')
    

提交回复
热议问题