Scroll and search through keyword lines by alphabetical order?
-
How can one scroll and search through main keywords only? Bookmarking keyword lines isnt permanent and cant scroll or search through them alphabetically.
Aluminum-
notesnotesnotesBoron-
notesnotesnotesCopper-
notesnotesnotesDysprosium-
notesnotesnotesEuropium-
notesnotesnotesFluorine-
notesnotesnotes -
Presume your “keyword” is some text at start of line followed by
-
followed by a line-ending.If so, make a macro to bookmark that line using a regular expression search of
^\w-$
. Assign the running of that macro to an unused keycombination.To counter the “isn’t permanent” complaint, run the macro by pressing the keycombo when you need it.
Regarding “alphabetically”, they already appear alphabetic. But, if they weren’t, there wouldn’t be a simple way to “search through them alphabetically”.
-
@Alan-Kilborn 's suggestion is reasonable, though I would use
(?i)^[a-z]+-$
to mark lines that contain only element names followed by a-
because every element name contains only ASCII letters.The JsonTools plugin features a treeview that can show all the search results for a regex search and jump to their locations in the document.
For example, if I have this document:
Hydrogen- foo bar baz Helium- foo bar baz Lithium- foo bar baz Beryllium- foo bar baz Boron- foo bar baz Carbon- foo bar baz Nitrogen- foo bar baz
the query
sort_by(s_fa(@, `(?s)^(\w+)-\r\n(.*?)\r\n\r\n`, false), 0)
(entered in the text box at the top of the treeview) will allow you to scroll through the elements in alphabetical order using the treeview.I have also created a PythonScript script that lets you sort multi-line blocks of a document alphabetically, but I don’t think that’s the best solution here because it changes the document, and you just want to iterate through it in a non-standard order.
-
@Alan-Kilborn said in Scroll and search through keyword lines by alphabetical order?:
^\w-$
I intended it to be
^\w+-$
but the+
got lost somehow. :-(