Meino Christian Cramer wrote:
Hi,
I read of a vimtip, that one can move/copy lines of a text which
match a cvertina pattern to line 0 (top) of the text.
This is a nice trick to gather material for a kinda quick'n'dirty
"Table of contents" it has one drwaback: The copied lines are in
reversed order.
Surely it is possible to write a fairly simple function with a
counter, which keeps track to what line something is copied.
But it would be interesting whether it is possible to achieve this
with more "condensed" tricks without writing a function in
beforehand.
Thank you very much for any idea/hack/trick in advance!
Keep hacking!
mcc
1. Place a mark on the first line. You have a choice of 26 names, I'll assume
t for "table of contents".
2. Copy your headings (e.g. with a :g command) to 't-1
(apostrophe-tee-minus-one, i.e., just above the marked line).
3. (Optional, and version 7 only) :delmark t
Best regards,
Tony.