Monday, February 22, 2016

Enclose Selection in Notepad Plus Plus

Enclose Selection in Notepad Plus Plus
You can use this Python Plugin script for notepad++ to wrapping selection text with any character. Remember, this method is trim white space for your input character and it will make contact between character and your selection so closely.

# enclose selection with character
char1=notepad.prompt("Insert before selection:","Enclose Selection","\"")
char1 = char1.strip()
if char1 == "":
    char1 = "\""
char2=notepad.prompt("Insert after selection:","Enclose Selection","\"")
char2 = char2.strip()
if char2 == "":
    char2 = "\""
editor.replaceSel(char1+editor.getSelText()+char2)

No comments:

Post a Comment