Create a variable by putting cursor in text and use a short cut


#1

I am not sure this is available because I have been looking. is it possible or could it be made possible to just write text and then at the end just hit a shortcode say [cmd+ctrl+v] and whatever you had typed becomes a variable? it would save us sometime instead of always going for the $ first. I don’t know why it bothers me but well… maybe I have a little OCD or plain laziness. 🤦


#2

You can add this to your init.coffee file:

atom.commands.add 'atom-text-editor', 'custom:format-as-php-variable', ->
  editor = atom.workspace.getActiveTextEditor()

  editor.moveToBeginningOfWord()
  editor.insertText('$')
  editor.moveToEndOfWord()