>> I just found a way to use vim as a calculator by using a Ruby one liner.
>> :!ruby -e 'puts 5*2'
>> will open a cmd window and output the result.
>> If you want to read the result into your vim buffer use:
>> :r!ruby -e 'puts 74/5.0'
> 
> To use Vim (without +ruby) as a calculator:

Though the OP's Vim didn't need +ruby either, for the record. But with a
+ruby Vim you can do such things as

:ruby puts 5 * 2

Back with Vim on its own, though:

>       :echo 5 * 2
> 10
> To save it to a register (here, the system clipboard):
>       :let @+ = 5 * 2
> To use a register in it
>       :echo @+ + 5
> 15

You can put this in your text by, in insert mode, doing <C-R> = and then
typing 5 * 2 or whatever. The '=' register lets you evaluate an
expression, putting the result in the text.

Ben.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to