-
Notifications
You must be signed in to change notification settings - Fork 5
ChangeHeadingLevel
Michael Butscher edited this page Jan 23, 2021
·
1 revision
Scripts which will increase/decrease the level of the headings in the selection.
Usage:
Ctrl-2 will increase the level of the headings in the selection,
Ctrl-3 will decrease.
Installing this: See here: HowToInstallGlobalScripts
<% 2: import re beginSel=editor.GetSelectionStart() endSel=editor.GetSelectionEnd() text = editor.GetSelectedText() p = re.compile(u"^\\+(\\++?)", re.DOTALL | re.UNICODE | re.MULTILINE) newtext, replacements = p.subn(r'\g<1>', text) editor.ReplaceSelection(newtext) editor.SetSelectionStart(beginSel) editor.SetSelectionEnd(endSel-replacements) %> <% 3: import re beginSel=editor.GetSelectionStart() endSel=editor.GetSelectionEnd() text = editor.GetSelectedText() p = re.compile(u"^(\\++?)", re.DOTALL | re.UNICODE | re.MULTILINE) newtext, replacements = p.subn(r'\g<1>+', text) editor.ReplaceSelection(newtext) editor.SetSelectionStart(beginSel) editor.SetSelectionEnd(endSel+replacements) %>