About: Perldoc function and module keyboard mappings   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Here's something similar I use, with these improvements on original post: 1. * Only sets up the mapping when editing perl files 2. * Sets up 1 smart mapping that automatically works for perl functions as well as modules 3. * Uses vim's build-in keyword definition feature instead of defining a new mapping In your .vimrc add these 2 lines: autocmd BufEnter *.pl,*.pm,*.cgi let oldkp=&kp | set keywordprg=perl \ -e\ $c=shift;exec\"perldoc\".($c=~/^[a-z]+$/?\"\ -f\ \":\"\ \").$c' autocmd BufLeave *.pl,*.pm,*.cgi let &keywordprg=oldkp See [help K]. Doesn't work. This is the error message I get.

AttributesValues
rdfs:label
  • Perldoc function and module keyboard mappings
rdfs:comment
  • Here's something similar I use, with these improvements on original post: 1. * Only sets up the mapping when editing perl files 2. * Sets up 1 smart mapping that automatically works for perl functions as well as modules 3. * Uses vim's build-in keyword definition feature instead of defining a new mapping In your .vimrc add these 2 lines: autocmd BufEnter *.pl,*.pm,*.cgi let oldkp=&kp | set keywordprg=perl \ -e\ $c=shift;exec\"perldoc\".($c=~/^[a-z]+$/?\"\ -f\ \":\"\ \").$c' autocmd BufLeave *.pl,*.pm,*.cgi let &keywordprg=oldkp See [help K]. Doesn't work. This is the error message I get.
Version
  • 5(xsd:double)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 613(xsd:integer)
Author
  • Adam Monsen
Complexity
  • intermediate
Created
  • 2003-12-10(xsd:date)
ID
  • 614(xsd:integer)
NEXT
  • 615(xsd:integer)
Rating
  • 22(xsd:integer)
abstract
  • Here's something similar I use, with these improvements on original post: 1. * Only sets up the mapping when editing perl files 2. * Sets up 1 smart mapping that automatically works for perl functions as well as modules 3. * Uses vim's build-in keyword definition feature instead of defining a new mapping In your .vimrc add these 2 lines: autocmd BufEnter *.pl,*.pm,*.cgi let oldkp=&kp | set keywordprg=perl \ -e\ $c=shift;exec\"perldoc\".($c=~/^[a-z]+$/?\"\ -f\ \":\"\ \").$c' autocmd BufLeave *.pl,*.pm,*.cgi let &keywordprg=oldkp Then when editing a perl file you can use perl's built-in keyword definition mapping (capital K == shift+k) when under a perl function or module to see it's POD. See [help K]. Doesn't work. This is the error message I get. Error detected while processing BufEnter Auto commands for "*.pl": E518: Unknown option: \ -e\ $c=shift;exec"perldoc".($c=~/^[a-z]+$/?"\ -f\ ":"\ ").$c' Try this: autocmd BufEnter *.pl,*.pm,*.cgi setlocal keywordprg=perl\ -e'$c=shift;exec\"perldoc\ \".(/::/?\"\":\"-f\").\"\ $c\"' (You don't need the BufLeave with setlocal) It's clumsy. If you try to look at docs for Modules like CGI or DBI perldoc -f will still be called. You have to press enter once or twice before seeing the desired documentation and once or twice afterwards, depending on various conditions. If there is a vimscript that handles this better I'd like to see it. Something that checks perldoc's exit code and tries again probably. Try this: autocmd FileType perl :setlocal keywordprg=perl\ -e\ '$c=shift;exec\"perldoc\ $c\ \|\|\ perldoc\ -f\ $c\ \|\|\ echo\"' This will try the keyword as a module first and if that fails it will call perldoc again with -f on the assumption that we're looking at a function. If that fails then echo an empty string to avoid some wierdities. However. It's still clumsy. You have to press q and then any key to get back to your buffer. Is there anyway to get this output into a help buffer? Try this: autocmd FileType perl noremap K :!echo perl -e '$line = ; if ($line =~ /(\w+::\w+)/){exec("perldoc $1")} elsif($line =~ /(\w+)/){exec "perldoc -f $1 perldoc $1"}' UPDATE: autocmd FileType perl noremap K :!echo perl -e '$line = ; if ($line =~ /([\w:]+)/){exec("perldoc $1 perldoc -f $1")}' 2>/dev/null This will work on: use MIME::Lite; use Encode; print("El Barto was here") $msg->send;
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software