All pastes #2947510 Raw Edit

Miscellany

public unlisted text v1 · immutable
#2947510 ·published 2015-03-03 05:28 UTC
rendered paste body
** ascii-art.coffee **
module.exports =
    activate: ->
        atom.commands.add 'atom-workspace', "ascii-art:convert", => @convert()

    convert: ->
        editor = atom.workspace.getActivePaneItem()
        selection = editor.getLastSelection()

        figlet = require 'figlet'
        figlet selection.getText(), { font: "Larry 3D 2" }, (error, asciiArt) ->
            if error
                console.error(error)
            else
                selection.insertText("\n#{asciiArt}\n")

** ascii-art.cson **
'atom-text-editor':
    'ctrl-alt-a': 'ascii-art:convert'

** package.json **
{
  "name": "ascii-art",
  "main": "./lib/ascii-art",
  "version": "0.0.0",
  "description": "A short description of your package",
  "activationCommands": {
    "atom-workspace": "ascii-art:convert"
  },
  "repository": "https://github.com/atom/ascii-art",
  "license": "MIT",
  "engines": {
    "atom": ">0.50.0"
  },
  "dependencies": {
      "figlet": "1.0.8"
  }
}