Backport cleanup/refactoring from ST3
Add RegReplace plugin option from ST3