FWIW you can do ad-hoc folding without any plugins by selecting all the text of interest (e.g., via Find All), and then using the Edit/Code Folding menu. In S1 there was an invert_selection command, which would enable selecting all the non-matching bits of text, I’ll have to add it back in for S3.
Fold Away Lines Not Matching A Pattern
Not sure what you mean. It matches all lines based on one pattern (string, actually; I failed to rewrite this as a regex).
What I would like to do is to automate precisely this. I think the ideal command would be folding (as well as inverted folding) based on a regex. This is very useful for logfiles, todo lists and other files where lines are standalone. (Some kind of hook between Goto Symbol and this command would also be useful…)
Alex
http://ndudfield.com/zencoding/old/Untitled\Untitled_media\Untitled.gif
I wrote a command back in the day for someone on the forum along them lines. The command would use folding to preview lines matching a pattern to filter from the document.
I’ll see if I can dig up the code.
That looks interesting – and more sophisticated (i.e., more moving parts) than what I described, but I’d have to use it to be sure – please share your code if you can dig it up!
Incidentally, I see you have a TODO.txt file open. Do you use anything to parse it, or do you use a long static file that you just scroll through?
Alex
TODO.txt is just one big text file I’ve been using since 2009 or so
New entries go at the top of the file
Don’t really use any special plugins
I always was annoyed that I hadn’t gotten around to making it show the whole current function/class/node/etc of a match, rather than a simplistic 2 lines above/below
More so, when using a similar technique for debugging / writing tmLanguage files
I might just try writing it again because I can’t find the code for that plugin
Ah, I see. I thought it parsed the indentation or the scope, which would have been quite a bit more ambitious.
You’re such a tease, I’m still waiting for those keybindings…
Soz, busy as shit atm
My old man’s coming to visit in me (overseas for him) and got an event need to have a new website up for.
Trying to smash it out so I can spend some time with him
FFFFFF. deadlines
FFFFF. Now you gone and called me on my BS.
Ok, you got me, it’s trick screencast photography. It’s not a real plugin.
If anyone is playing along, I have a slightly improved version of this plugin here:
raw.github.com/alehandrof/MarkD … Folding.py
It’s part of a bigger mess called MarkDo that I will clean up and describe soonish*.
What it does
Trigger the plugin with a binding such as this:
{ "keys": "ctrl+'"], "command": "all_toggle", "args": { "foldstr": "" } },
If there is nothing folded, it will fold all lines NOT matching (in order of preference):
- the selection
- the “foldstr” argument
- user input
When there are folded sections, triggering the plugin will unfold everything. (It’s a toggle, you see.)
Sorry for the very sloppy instructions Let me know if you need any help using this.
- One hopes.
Alex