Crunch : An easier way to perform calculations inside Vim
| script karma
Downloaded by 148
Comments, bugs, improvements
script versions (upload new version)
An easier way to perform calculations inside Vim
The most up to date version of this plugin can be found here:
Crunch makes calculations in Vim more accessible and loosens Vim's math syntax. Most of Crunch's looser syntax is accomplished by extensive search and replace. Crunch also forces floating point to be used.
Requirements: Vim compiled with +float feature.
Crunch allows you to just type in mathematical expressions without having to worry about the syntax as much.
Where is some mathematical expression to be evaluated. The result is then available to be pasted from the default register.
Crunch then gives you the following prompt in the command line: Calc >> for you to enter you mathematical expression. The result is then available to be pasted from the default register.
:CrunchLine, :'<'>CrunchLine, or <leader>cl
Crunch Uses the current line or the visually selected lines as the expression(s) and adds the result to the end of the line(s). When the expression(s) changes using :CrunchLine again will reevaluate the line(s)
:CrunchBlock, or <leader>cb
Crunch Uses the current paragraph (block of text starting and ending with an empty line) as the expressions and adds the result to the end of the lines. When a expressions in a paragraph changes using :CrunchBlock again will reevaluate them
See the Github page for Animated Gif Demos
Make Crunch Better
I'm pretty new to Vim Script so any tips are appreciated. Think you can make Crunch better? Fork it on GitHub and send a pull request. If you find bugs, want new functionality contact me by making an issue on GitHub and I'll see what I can do.
Sources inspiration and credits for this plugin
http://patorjk.com/ ASCII font courtesy of Patrick Gillespie
https://github.com/gregsexton/VimCalc Greg Sexton Wrote Vimcalc
http://vimrc-dissection.blogspot.com/2011/01/vim-inline-calculator-revisited.html Ihar Filipau wrote most of the tagging code as well as VIM incline calculator
https://github.com/hrsh7th/vim-neco-calc hrsh7th wrote Neco-calc, and inspired the int to float conversion method
|If you don't have an preferred method, I recommend one of the following plugin managers.
Click on the package to download.
ip used for rating: 220.127.116.11
||- The # has been removed from variable declaration/usage
- evaluate math enclosed in comments.
- :CrunchBlock command evaluates blocks at a time
- various other large and small fixes