Pages

Friday, January 10, 2014

Nailed it!

So that one big thing I wanted jEdit to do but couldn't?  I figured out a workaround.  It isn't the cleanest, but it works.  I wanted Markdown headings to show up in Sidekick's tree view so I could easily navigate my documents by heading (aka chapter title).  I looked again for plugins no avail.  I played with Sidekick's settings, read it's manual, didn't see anything to help.

Looked at the settings for the custom fold handle plugin, but while I could set custom folding handles for each document type, I couldn't have my other handles "[" and "]" active at the same time.  Darn it.  Since pretty much all my work is saved as *.txt files, there's no easy way to change edit modes on the fly.  Then again...

I tried setting a custom handle for tex, I changed the mode in buffer options, but there are two problems.  One, if # (Markdownese for "header") opens the fold, what closes it?  Markdown doesn't use closing tags.  I set the tilde, a character I never use, and went to see how Sidekick handled it.  Well, all my headings showed up, but since there were no close tags every one was nested in the one before it, making them a little hard to navigate.  Okay, well I use italics some, maybe I can have an asterisk close them.  That closed about half my folds, still not a good solution.  I thought about using a forward slash, which I don't think shows up in converted Markdown, but it would clutter up my text.  Finally I realized how stupid I was being, and set periods to close tags.  I know I don't have one single section that doesn't use a period.  That problem is solved.

The second problem is that changing the buffer's edit mode is a one-time only thing.  Could I set up a macro to do it, thus enabling me to bind it to a keys combination?  Hmm, if only there already were a macro to switch modes.  A Mode Switcher, if you will.  And alas, I found one, in fact it's included in jEdit by default.  So I set up a shortcut to the macro, and now when I want so see my headers in an outline-style tree, I simply hit the shortcut, type "tex", hit enter and browse away.

I could make this cleaner.  I have two types of files.  Actual prose files which are written in Markdown, and planning files, which are huge and blathery and require very strict organization.  I could give one type one particular extension, perhaps giving proper Markdown ones the standard *.md, and set up jEdit to always open that extension in a particular edit mode, but that's just not how I roll.  Also I'm lazy.  I may do it.  It seems a much more elegant solution, but for now I should probably focus on actually working.

Working?  You know, that thing I was supposed to be doing when I ended up looking into custom tree views and blogging it later.

David

No comments:

Post a Comment