# -*- coding: utf-8 -*- ''' :Title Make Selection Monaco 10 :Author Flying Meat :Website http://flyingmeat.com/ :Planguage Python :Requires VoodooPad 3.5+ :Description This plugin will change the currently selected text to Monaco 10.
The shortcut for this plugin is Command-Control-M EOD ''' VPScriptMenuTitle = "Make Selection Monaco 10" VPShortcutMask = "command control" VPShortcutKey = "m" import AppKit def main(windowController, *args, **kwargs): textView = windowController.textView() f = AppKit.NSFont.fontWithName_size_("Monaco", 10) attrs = {AppKit.NSFontAttributeName: f} # wrapping our change in shouldChangeTextInRange_replacementString_ + didChangeText # allows for free undo support if textView.shouldChangeTextInRange_replacementString_(textView.selectedRange(), None): textView.textStorage().setAttributes_range_(attrs, textView.selectedRange()) textView.didChangeText()