Can I surround selected text with characters?

I’m sorry if this sound a bit dense to you Macro Mavens here! But I’m having a hard time determining if I can create a KM shortcut to surround selected text with angle brackets, quotes, parentheses, etc. Could anyone advise?

You certainly can. I think the simplest way to do so is by copying the selected text to the clipboard and then using the "insert text" action to paste the clipboard surrounded by the surrounding text, like so:

You could also check out Andreas's Markdown library for Keyboard Maestro, which includes a plugin to wrap text.

1 Like

Ooooh-RAH! Beautiful!! Thank you so much, Michael!

As a writer, I type “bracketing” symbols hundreds of times a day. It’s something I find tedious and an additional load on the hands. I’ve been using your solution all day, and it’s magic!

Now…if I may prevail upon your good will for just one more solution that has so far eluded me: Using the same highlight mechanism, can I replace spaces within the phrase with underlines, hyphens or dashes?

Thank you again for your time!

–Dennis

You'll find the search and replace clipboard action very useful:

Wow. Simple and elegant! These two solutions you gave me today will allow me to get rid of a RAM-hungry one-trick-pony that I’ve used up till now to do these deeds. Thank you so much, Michael!

The screenshots are gone. Can anyone help me? I would also like to do this.

@Ihventura_Hutch, It is pretty easy. Do this:

  1. Select the text you want to surround with other characters.
  2. Use a KM Copy action
  3. Use a KM Insert Text by Pasting action, with this in the text box:
    <<%SystemClipboard%>>
2 Likes

Thanks!

how could we use this as a toggle? is there an easy way to detect those << and >> at the start and end of the text so we remove them?

also, is there a way to remove the last element of the history of the clipboard? (for the times i don't want to change my clipboard but still format text like this)

thanks!
Ken Vega

Search and Replace action should do the job.