Calculate im Vim

If one wants to calculate in vim one simply has to write the following line:

2 pi mult

and visually select it with V then pass it to rpnl or calc or bc or so via xargs

:!xargs rpnl

to get the result in the line.

This trick also works with other commands, like e. g. writing

"from math import sin; print(sin(2 + 3))"

and then run

:!xargs python -c 

and the line will be replaced with -0.958924274663.

links

social