Im running OSX Yosemite and i need to paste certain patterns repeatedly. I only need to change parts of those. E.g.

<tag>something</tag>
    <p>blehbelhbleh</p>
     <asd>... lots of complex stuff...
...<id>000</id>

Instead of manually finding and changing the parts I'd like to have a pattern with "placeholders"

e.g.

<tag>#title#</tag>
    <p>blehbelhbleh</p>
     <asd>... lots of complex stuff...
...<id>#id#</id>

and on paste i get a inputbox/popup asking for those values

  • You are using a Unix system. Don't fear the blinking cursor :) Learn to use the command line text processing utilities, set up a template for the whole file using tokens that you know won't be anywhere else, and process with sed or similar. If it is a group of files, you can even use a Makefile with the make command to do it. – ivanivan Apr 5 at 2:27

Doesn't include the 'popup' to add info, so you'd have to place the cursor manually, but the Mac can do the rest of that itself, no 3rd party software needed.

System Prefs > Keyboard > Text
Add a trigger word, then your replacement.
[The visible examples below are just what I use for SE markdown entry, but you can make them as complex as you like - my complex ones tend to contain personal info, so not shown]

enter image description here

If you need multi-line entry then the best way is to type it into a text document first, then copy/paste to the 'With' section.

It's easy to make plugin for CudaText editor. For macOS. Plugin must:

  • read current text
  • find #macros# (list of)
  • ask user with dialog, all of values for list
  • replace #macros# with entered items
  • I don't quite understand how this answers the question. – rrirower Dec 16 '16 at 19:53

I use textexpander to do this on my Mac. From their features list on their website:

TextExpander has many features to help you sling code, create scripts, craft HTML and CSS, and satisfy the geek in all of us. • Built-in HTML, CSS, AutoCorrect, accented words, symbols, Emoji snippet groups • For programmers, make editor-independent code templates • Invoke multi-platform JavaScript, AppleScript and shell scripts • Shorten long URLs automatically (Internet Productivity snippet group) • Automatically insert clipboard content in a snippet • Import data from other type expansion apps • Import and export snippet group files

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.