@context

Script key

Posted by @nahumck

Install

Details

Label @context
Voice Over
Script
// Insert @context tag for use with taskpaper
// If no text is selected, inserts the "@context()" tag
// with the cursor moved inbetween the parentheses.
// If text is selected, inserts the "@context()" tag
// with the selected text inbeween the parentheses.

var sel = getSelectedText();
var selRange = getSelectedRange();

if (!sel || sel.length == 0) {
  setSelectedText("@context()");
  setSelectedRange(selRange[0]+9,0);
}
else {
  setSelectedText("@context("+sel+")");
  setSelectedRange(selRange[0]+selRange[1]+5,0);
}

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus