I have a perl file with several instances of a variable number of comment lines, followed by a subroutine or variable declaration in the leftmost column with a comment with a fold marker on the same line as the declaration:

````
# comment here
# maybe more comment here
sub subname { #{{{1
...

# comment here
my %hash = ( #{{{1
...
````

What I want to do is to get a commented-out copy of the line with the fold marker above the first of the variable number of comment lines above that line:

````
# sub subname #{{{1
# comment here
# maybe more comment here
sub subname {
...

# my %hash #{{{1
# comment here
my %hash = (
...
````

Naturally I have a decent idea of how that could be done with a Perl script :-) but I wonder if there is a way to do it with Vim that can be put in a command -- preferably a way where I can confirm every instance an preferably a oneliner. I can live with getting the assignment operators and brackets copied along with the sub/variable names. Note that I want the comment marker immediately before the fold marker preserved, as I search for `#{{{\d\+` to remove the fold makers when I'm done.

/bpj

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to