Calc Variables Feature Description
When working with Keypirinha's Calc plugin, one may want to save the result of the calculation for later use in other calculations. This features enables that using one the following patterns:
var=expr
or:
expr=var
For example:




The variables are stored persistently in a file variables.jsonlocated in the plugin's local folder.
Enjoy
Original proposal:
Proposal to allow Calc to save results as variables for later use.
Examples:
12+3 > a => 15
a/5>b => 3
a>b => 1 (the space after b disables the 'save to b' so this checks if a>b)
'abcd' >c => abcd
len(c) => 4
c+'x' => abcdx
2+1>pi => Error: cannot override constant value
Notes:
- Variables names must start with an alphabetic character and may also contain digits.
- Variable name on saving cannot have trailing spaces. If spaces trail variable name, it is ignored.
- Variables are transient and are gone once the Calc plugin reloads.
I have implemented this (+19 lines) and its works nicely. If it's of interest, I'll submit a PR.
Calc Variables Feature Description
When working with Keypirinha's Calc plugin, one may want to save the result of the calculation for later use in other calculations. This features enables that using one the following patterns:
var=expror:
expr=varFor example:
The variables are stored persistently in a file
variables.jsonlocated in the plugin's local folder.Enjoy
Original proposal:
Proposal to allow Calc to save results as variables for later use.
Examples:
12+3 > a=> 15a/5>b=> 3a>b=> 1 (the space after b disables the 'save to b' so this checks if a>b)'abcd' >c=> abcdlen(c)=> 4c+'x'=> abcdx2+1>pi => Error: cannot override constant value
Notes:
I have implemented this (+19 lines) and its works nicely. If it's of interest, I'll submit a PR.