From 997894edc04e87b0ba0c81712c92a83ec7f5c121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 20 Sep 2019 21:37:01 +0200 Subject: core: add calculation of expression in evaluation of expressions with "calc:..." (issue #997) --- src/core/wee-command.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/core/wee-command.c') diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 1f5debd96..d5d3846dd 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -7363,9 +7363,11 @@ command_init () " 10. an environment variable (format: \"env:XXX\")\n" " 11. a ternary operator (format: " "\"if:condition?value_if_true:value_if_false\")\n" - " 12. an option (format: \"file.section.option\")\n" - " 13. a local variable in buffer\n" - " 14. a hdata name/variable (the value is automatically converted " + " 12. result of an expression with parentheses and operators " + "+ - * / // % (format: \"calc:xxx\")\n" + " 13. an option (format: \"file.section.option\")\n" + " 14. a local variable in buffer\n" + " 15. a hdata name/variable (the value is automatically converted " "to string), by default \"window\" and \"buffer\" point to current " "window/buffer.\n" "Format for hdata can be one of following:\n" @@ -7401,6 +7403,7 @@ command_init () " /eval -n ${if:${info:term_width}>80?big:small} ==> big\n" " /eval -n ${rev:Hello} ==> olleH\n" " /eval -n ${repeat:5,-} ==> -----\n" + " /eval -n ${calc:(5+2)*3} ==> 21\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" -- cgit v1.2.3