Hyphenate-Me-Up➖
For that I-want-to-hyphenate-all-these-words feeling

Script key: For that I-want-to-hyphenate-all-these-words feeling

Posted by @paulstroudmusic

Install

Details

Label Hyphenate-Me-Up➖
Voice Over For that I-want-to-hyphenate-all-these-words feeling
Script
// Script keys run short Javascripts
// For documentation and examples, visit:
// http://help.agiletortoise.com
// You may want to remove the extra text in the label of this extension
// It's a simple find replace. Finding spaces and replacing them with hyphens
// It won't ignore any space after the last selected word 
// e.g. |my-something-| vs |my-something|

var f = ' ';
var r = '-';
var s = getSelectedText();

var re = new RegExp(f, 'g');
var matches = s.match(re);

if(matches) {
  s = s.replace(re, r);
  setSelectedText(s);
}
else {
  alert("\"" + f + "\" not found.");
}

Advanced

Keyboard shortcut Option+Command+-
Hide key Yes

Discussion

comments powered by Disqus