Version 0.8
- New “mark” and “unmark” actions
- Return error dialog showing regex issue
- Add support for scope search with regex find and replace in scope region
- Smarter folding of regex regions for “fold” action
- Small tweak to non-greedy algorithm
- Change default of optional replace parameter to “\0”; do not delete by default, leave unchanged by default.
- Allow spaces in the “Regex Input Sequencer”
One big thing to stress is the change of the default value of replace. If you have definitions that relied on the old default of “”, the new default is “\0”. I decided it was better to not replace anything by default instead of deleting everything by default.
The other thing to note, is now when you create a malformed regex expression, you should get an error dialog giving you the internal error: things like unmatched brackets etc.
So now that scope selection is in, it is super easy to target difficult things like comments in every language. Here is a simple definition to delete all comments.
This is included in the default settings. It simply removes the comments leaving the line in tact
"remove_comments": {
"scope": "comment",
"find" : "(^\\n\\r]+)",
"replace": "",
"greedy_replace": true
}
Here is the actual command:
{
"caption": "Remove: All Comments",
"command": "reg_replace",
"args": {"replacements": "remove_comments", "remove_trailing_spaces"], "find_only": true}
},
Folding is much better now. Folding now will automatically adjust regions that have trailing newlines so as not to fold lines into each other.
Here are the fold/unfold commands:
// Folding
{
"caption": "Code Folding: Fold All Comments",
"command": "reg_replace",
"args": {"replacements": "remove_comments"], "action": "fold"}
},
{
"caption": "Code Folding: Unfold All Comments",
"command": "reg_replace",
"args": {"replacements": "remove_comments"], "action": "unfold"}
}
The mark and unmark actions are pretty self explanatory. It simply allows you to highlight specific searches by whatever scope you choose. You can have multiple different regex highlights on the screen at the same time as long as you give them unique keys. How to use them is documented in the readme. The highlights will persist until you delete the region, or clear them with the unmark command, etc. I guess it might be good if you have things you are always looking for in certain files. You can make them stand out a lot. It might not be that useful, it is kind of similar to the “find_only” option; the only difference is it doesn’t disappear until you clear it. But it was easy to to add…so there it is.