Automatic char replace


In scala you can use ⇒ instead of =>. Is there a plugin that can replace this automatically as you type?


something similar to this:


Add this to your init script (File > Init Script)

Replaces on save.

atom.workspaceView.on 'core:save', ->
  editor = atom.workspace.getActiveEditor()
  return unless editor?.getGrammar()?.scopeName is 'source.scala'
  text = editor.getText()
  text = text.replace /(^|\s)(=>)(\s|$)/g, ($0) -> '⇒'

Not sure if there’s an editor:insert-text like event.


thanks a lot. That’s a good start


Sorry to bother you with something so trivial but I have no life. The line above is not needed. The next line with return will cover that case.