sponsor Vim development Vim logo Vim Book Ad

RPN : Vim RPN calculator

 script karma  Rating 0/0, Downloaded by 1106  Comments, bugs, improvements  Vim wiki

created by
Salman Halim
 
script type
utility
 
description
Examples:

echo Rpn#Eval( '2 3 +' )
Or
echo Rpn#Eval( 2, 3, '+' )

Suggested command:
com! -nargs=+ Rpn echo Rpn#Eval( <f-args> )

Then, Rpn 2 3 + echoes the result.

Operators:
+
-
*
/
%
^

Commands:
d: duplicate last entry
r: reverse last two entries
v: square root the last entry

Special:
ans: Replaces with the answer from the last entry
 
install details
Put it in your autoload directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
rpn.zip 1.5 2019-01-16 7.0 Salman Halim New commands:

c: clear the stack
f: print the entire stack
p: display the last entry on the stack (done by default at the end, anyway)
k: set precision (number of decimal places)
K: push the precision onto the stack
!: replace the item with its negative value
Z: replace the item with the number of characters it takes up (number of digits plus decimal point and negative sign)
z: push the size of the current stack
x: remove the entry (pop and destroy)

New special:

tax: Equivalent to multiplying by g:Rpn_taxRate. For example, if you set g:Rpn_taxRate to 1.5, then executing 'Rpn 3 tax' is the same as 'Rpn 3 1.5 *' -- I use it for sales tax calculations
rpn.vmb 1.0 2013-11-25 7.0 Salman Halim Left out a needed file *blush*
rpn.vim 1.0 2013-11-25 7.0 Salman Halim Initial upload
ip used for rating: 54.172.169.199

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github