Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: folding Data::Dumper output

by stevieb (Canon)
on Dec 12, 2018 at 23:24 UTC ( [id://1227185]=note: print w/replies, xml ) Need Help??


in reply to folding Data::Dumper output

No worries asking vim (or Emacs) questions related to Perl. If it's about Perl, you're loved. If it's about vi(m) you're also loved. If it's about Emacs, some will love you ;)

I've never thought about wrapping output before. I wrap my subs in the following way in my .vimrc.

function GetPerlFold() if getline(v:lnum) =~ '^\s*sub\s' return ">1" elseif getline(v:lnum) =~ '\}\s*$' let my_perlnum = v:lnum let my_perlmax = line("$") while (1) let my_perlnum = my_perlnum + 1 if my_perlnum > my_perlmax return "<1" endif let my_perldata = getline(my_perlnum) if my_perldata =~ '^\s*\(\#.*\)\?$' " do nothing elseif my_perldata =~ '^\s*sub\s' return "<1" else return "=" endif endwhile else return "=" endif endfunction setlocal foldexpr=GetPerlFold() setlocal foldmethod=expr

I'm very curious to find out how this ends up. Never thought of having folds in a dumper output before.

Please supply an example output so that there's something to test/work with. Preferably, within your OP so that everyone has a chance to see it.

Replies are listed 'Best First'.
Re^2: folding Data::Dumper output (Emacs)
by LanX (Saint) on Dec 13, 2018 at 19:44 UTC
    > If it's about Emacs, some will love you ;)

    talking about ... xD

    Activating cperl-mode and hs-minor-mode is all you need to be able to fold Perl data structures with hide-show commands.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-03-28 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found