Keyboard Shortcut for [[Bracketing]] Wikilinks?

Hi all,

More apps I use are allowing wikilinks and I’d like a universal way to quickly turn a phrase into one via [[double brackets]]. Ideally I could create something that mimics the way coding programs open and close brackets smartly, but that seems a distant and unlikely future, so how about a KM shortcut or TextExpander snippet I could devise that, (1) upon highlighting a word and (2) pressing a key command, (3) brackets would be put at either end?

Anyone know if that’s doable and how?


Here’s a simple Keyboard Maestro solution:


Using this macro, you can just put the carat in the word to linkify, then press the hotkey.


Thank you both!

@JohnAtl: to clarify, does carat == cursor? Also, this will only work for single words, right? Not if I wanted a [[Multi-word Phrase]] bracketed?

1 Like

[[Just]] [[wanted]] [[to]] [[verify this works]] [[a charm]].

1 Like

I realize you have a solution, but posting yet another option just for awareness.

PopClip could be an avenue. There is a single brackets extension. I don’t see one for double. However, it’s not too hard to create your own extensions.

Posting this information here as it is not too hard to create new PopClip extensions. This is a good tool to have in the toolkit!

For that matter, while the following may introduce risk of your change being overwritten at some point, you could modify the existing brackets extension to use [[ instead of [

~/Library/Application Support/PopClip/Extensions

Show Package Contents for Brackets.popclipext

Edit the brackets-square.php file (any text editor)

From: echo ‘[‘.$input.’]’;
To: echo ‘[[‘.$input.’]]’;

that’s it!

If you go with @ryanjamurphy’s macro to handle multi-word links, I suggest you add an initial step that saves the current clipboard to a variable and then a final step that saves the contents of that variable back to the clipboard. That way, your clipboard comes out of the macro in the same state it was.

1 Like

Or just Delete Current System Clipboard as the final step and the previous clipboard will be restored; no need to set a variable (but you may find you have to set a brief pause before deleting).

1 Like


Right. Didn’t think about that.

I use PopClip all the time (as suggested by @jayelevy) , and that’s probably the more convenient solution.

I agree with this.

To be clear, I used the system clipboard in the example purely because I was trying to race @JohnAtl to the first solution. :sweat_smile:

I think I’d actually use a named clipboard instead of a variable, but I doubt it would ever matter.


Yes, thank you! I had always been under the impression that if I wasn’t using KM’s Clipboard History Switcher, KM wouldn’t keep track of my clipboard history. Now I’ve learned that it does.

1 Like