DEV Community

Discussion on: I spend one hour a week optimizing my development environment.

Collapse
 
oryanmoshe profile image
Oryan Moshe

Love the Control on hold idea, would definitely try it out and see if it suits my style!
As much as I love cli tools, dc is a bit too hardcore for me, usually the calculations I do are stuff like 24*60.

Collapse
 
gypsydave5 profile image
David Wickes

As much as I love cli tools, dc is a bit too hardcore for me, usually the calculations I do are stuff like 24*60.

For me it really shines as a part of an editor workflow. You can write the calculation on a line in Vim (or whatever), and then pipe it into dc and see the result in your editor.

bc is also available if you're not a fan of reverse Polish notation :D

Thread Thread
 
oryanmoshe profile image
Oryan Moshe

For vim this definitely works better than Alfred.
When I'm in a vim zone I usually don't use much of the GUI so it might be worthwhile to learn dc better!

Thread Thread
 
kungtotte profile image
Thomas Landin • Edited

For quick calculations you don't even have to leave vim or pipe out to anything!

<C-r>= in insert mode lets you type mathematical expressions and have the result inserted into your buffer. You need to add a decimal point if you want a floating point result otherwise it truncates to integers.

Bonus tip:
[num]<C-a> and [num]<C-x> will add or subtract num from the number under the cursor or the next number on the line if there's no number under the cursor. It defaults to 1 if you leave [num] out.

Collapse
 
kbilleter profile image
kbilleter

qalc is good