Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Vim Settings for Perl

by runrig (Abbot)
on Mar 23, 2005 at 21:50 UTC ( #441900=note: print w/ replies, xml ) Need Help??


in reply to Vim Settings for Perl
in thread Desparately seeking a bilingual vim/Emacs expert

I like having perldoc output to a split window, and I wanted to output module documentation if you were on a 'use Module;' line, so I recently came up with this (my vim-foo could probably be better):

function! PerlDoc() normal yy let l:this = @ if match(l:this, '^ *\(use\|require\) ') >= 0 exe ':new' exe ':resize' let l:this = substitute(l:this, '^ *\(use\|require\) *', "", "") let l:this = substitute(l:this, ";.*", "", "") let l:this = substitute(l:this, " .*", "", "") exe ':0r!perldoc -t ' . l:this exe ':0' return endif normal yiw exe ':new' exe ':resize' exe ':0r!perldoc -t -f ' . @ exe ':0' endfunction "Display docs for built-in functions when cursor is on function name "or for modules when cursor is on 'use' or 'require' line. map ,h :call PerlDoc()<CR>:set nomod<CR>:set filetype=man<CR>:echo "pe +rldoc"<CR>
Updated. (I knew nothing about Vim programming before I started this...it took a couple of hours to come up with the first version of this, so comments, etc., welcome).
Update: Added set nomod.
Update: Added filetype, C-M=>CR, echo message
Update: added -t


Comment on Re: Vim Settings for Perl
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://441900]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (19)
As of 2015-07-02 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls