I am taking notes in an outline format that looks like this:
* Micro topic 1 ** Microbes are small ** You can't see them! *** Isn't that something? * Micro topic 2 ** I hope I like the teacher *** She will be great! ** Micro is cool!
where one star is a top level heading, and more stars indicate subheadings as in a typical bullet point outline.
My goal is to automatically convert them into a .csv file like so:
"* Micro topic 1"," "** Microbes are small", "** You can't see them!", "*** Isn't that something?", "* Micro topic 2", "** I hope I like the teacher", "*** She will be great!", "** Micro is cool!"
Where the first column contains only top level headings (lines beginning with one star), and the following columns are subheadings belonging to their parent top level heading. My challenge is that I don't know how to get vim macros to be aware of when the encounter a new top level heading, and should therefore not join it to the previous line.
So far I've got:
i" $", J
to surround a line in quotes, add a comma, join with the following line and repeat. But how to skip joining lines if the next line starts with
*, or regular expression