Maynard : An RPN calculator in an input() prompt
script karma |
Rating 0/2,
Downloaded by 392 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Toby Thurston |
|
script type |
utility |
|
description |
Maynard is a (very) simple stack-based RPN calculator written in Python 2.5+ and featuring Python Decimal numbers.
It uses the Vim "input()" function to show the stack and to get input from the user. So if you enter "2 3 *" you'll get "6" on the stack. Etc.
Press the = key to write the number at the top of the stack into the current buffer. Press <ESC> to exit. Look at the source for other commands.
If you have never used an RPN calculator this will probably annoy you, but if you have ever used an HP calculator then it should be reasonably familiar. I'm keen to get feedback on this one, but please be kind: I'm new to both Vim and Python so it can probably be improved in all sorts of ways.
toby@cpan.org
Brother Maynard is a Python reference by the way... |
|
install details |
Unzip maynard.zip into any directory where you keep python files or VIM scripts. It will create maynard.py and decimal_tools.py. If you keep them together then Python will be able to find decimal_tools when it needs it. However you may still need to set $PYTHONPATH in your profile so point at the directory where you put "python_tools.py". Try adding something like this to your .profile (assuming Mac or Linux):
export PYTHONPATH=.:<path-to-file>
Add a line something like this to your .vimrc file
:command! -nargs=0 <name> pyfile <path-to-file>/maynard.py
where <name> is whatever you want to use to call it, and <path-to-file> reflects where you unzipped it. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.191.157.186
|