I have an org-mode
file containing a structure like this:
*** H1
**** H2
- Foo
Foo
**** H2
Foo
Foo
I would like to make a copy of H1
and all it's subheadings, but none of the non-headline content. I would then like to be able to paste this copy, adding the following content to the file:
*** H1
**** H2
**** H2
Currently the way I do this is to collapse H1
using yy
(I use evil-mode
), move to the appropriate place, with p
, and then manually delete all the non-headline content.
How can I copy+paste org-mode
headlines only?
org-mode
custom function that narrows to the subtree desired and visits each headline in that narrowed section to gather what is needed, modifying the structure if needed, and place the result in the kill-ring. If you are doing this only occasionally, then themultiple-cursors
package can do this in just a couple of moves -- i.e., narrow to subtree, select the stars (select all like this), move to the far left, select from there to the far right, and copy, and exit, then go to a new buffer and typeC-x r y
and there you go.outline-hide-leaves
as first step.