From d459614436896e351b9c373a84cc4f0a9eea4926 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 26 May 2014 09:29:33 +1000 Subject: [PATCH] simple surround util script to add () around the selection --- .../qtcreator/externaltools/qtc_select_surround.py | 10 ++++++++++ .../qtcreator/externaltools/qtc_select_surround.xml | 11 +++++++++++ 2 files changed, 21 insertions(+) create mode 100755 utils_ide/qtcreator/externaltools/qtc_select_surround.py create mode 100644 utils_ide/qtcreator/externaltools/qtc_select_surround.xml diff --git a/utils_ide/qtcreator/externaltools/qtc_select_surround.py b/utils_ide/qtcreator/externaltools/qtc_select_surround.py new file mode 100755 index 0000000..2c2af5f --- /dev/null +++ b/utils_ide/qtcreator/externaltools/qtc_select_surround.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +import sys + +# TODO, accept other characters as args + +txt = sys.stdin.read() +print("(", end="") +print(txt, end="") +print(")", end="") + diff --git a/utils_ide/qtcreator/externaltools/qtc_select_surround.xml b/utils_ide/qtcreator/externaltools/qtc_select_surround.xml new file mode 100644 index 0000000..ca7c9a2 --- /dev/null +++ b/utils_ide/qtcreator/externaltools/qtc_select_surround.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<externaltool id="qtc_select_surround"> + <description>Surround selection with parentheses or other optionally other characters.</description> + <displayname>Surround selection with parentheses</displayname> + <category>Formatting</category> + <executable output="replaceselection" error="showinpane" modifiesdocument="no"> + <path>qtc_select_surround.py</path> + <input>%{CurrentDocument:Selection}</input> + <workingdirectory>%{CurrentDocument:Path}</workingdirectory> + </executable> +</externaltool> -- GitLab