HowMuch by Kai Yuan

HowMuch README file

    __  __              __  ___           __       ___ 
   / / / /___ _      __/  |/  /_  _______/ /_     /__ \
  / /_/ / __ \ | /| / / /|_/ / / / / ___/ __ \     / _/
 / __  / /_/ / |/ |/ / /  / / /_/ / /__/ / / /    /_/  
/_/ /_/\____/|__/|__/_/  /_/\__,_/\___/_/ /_/    (_) 

  - A Vim calculator for visual selections

(http://www.vim.org/scripts/script.php?script_id=4761)

Table of contents

(toc is generated by ghtoc)

Introduction

HowMuch is a Vim plugin to calculate visual selected mathematical formulars (vim or bc expressions). It will add the result(or replace the selected expressions) in the current edit text. For details check next section: Features

Features

!Please read plugin documentation (HowMuch-config section) for options, mappings

Command

HowMuch can be invoked by command as well. There is a :HowMuch [flags] command. We can first visual select the expressions, then for example do :HowMuch s= to append result with = sign to the end of selection, also add a sum at the bottom of selection. :HowMuch command only work for 'autoCalc' mode Read :h :HowMuch for the available flags.

Examples & Screencasts

Examples and screencasts would be the best way to explain how does HowMuch does its job. In the demo section, only Auto-Calc will be demoed. The calculation can be done by certain engine. E.g

Details please check plugin documentation.

All demos were made with following settings.

"The scale of the result:
let g:HowMuch_scale = 2 
"the engine order for auto-calculation
let g:HowMuch_auto_engines = ['bc', 'vim', 'py']

Auto-Calc Demo

Auto-calc will evaluate each expression with each engine in turn, taking order from g:HowMuch_auto_engines, till a result without error comes out. If all engines give Err. E.g an expression like ##+foo, result is Err.

As long as there was an Err, the result of sum would be Err

Demo 1:

Demo 2:

Demo 3:

Demo 4:

Demo 5: