Can I do optional math in Sublime Text?

Other than writing my own plugin for this, is there a mechanism by which I can add / subtract from several selected numbers?

I need to apply the same equation (in this case, subtract 5) to many values; and I would rather not do it individually. Could this be work for another program?

+7
source share
4 answers

If you are already using Emmet (which I highly recommend), use the Evaluate Math function. No need to install more plugins. Only problem is that it reduces the result by 2 decimal places.

+13
source

There, the plugin is called Sublime-Evaluate , which allows you to evaluate Python bits and output it directly to your buffer. For example, [i for i in range(5)] is evaluated, converted to [0, 1, 2, 3, 4] . It can also be used for arithmetic operations, just use these multiple selections and write +5 after each value, then select everything and evaluate. A plugin usually wraps the positions of your cursors, do not confuse them.

+4
source

Saw yesterday and thought I would do it. It basically does the same as Sublime-Evaluate (to what I had not seen before, it could save some time). Anyway, my advantage is that you can predefine python fragments to run. It also performs some variable substitution of the contents selected by the cursor. It does not make any extension, so you will need to select the content to insert. I was thinking of creating a setting to change the word separator for the plugin, but haven't decided yet. If you have an opinion on this, let me know.

https://github.com/skuroda/EvalInsert

+2
source

Sublime Calculate evaluates selected text and is great for small calculations, especially when combined with the replace option: https://github.com/colinta/SublimeCalculate

As stated earlier, Sublime Evaluate has a python score: https://github.com/jbrooksuk/Sublime-Evaluate

+2
source

All Articles