Is there a plugin can insert spaces around operators


#1

I am learning Pythong, as I am taught the convention is coding like this:

isNum = a + b

not isNumb=a+b

but always input spaces is boring, is there a plugin can do this for me in Atom automatically?

thanks!


#2

I don’t know of one. It would be doable, but you might have to do it yourself. I have another suggestion. You can make a set of snippets that look like

'*':
  'Equals Plus':
    prefix: '=+'
    body: ' = $1 + $2'
  'Equals Minus':
    prefix: '=-'
    body: ' = $1 - $2'

and then type isNum=+ and tab. The cursor will be placed at $1 and you can press tab again to jump to $2. You could even have + or = expand to just have spaces around them, if you don’t mind using tab a lot.


#3

Many thanks for your help, it sounds good, I’ll try.