summaryrefslogtreecommitdiffstats
path: root/runtime/doc/eval.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r--runtime/doc/eval.txt31
1 files changed, 28 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 6e7090acdf..95d14ef5b2 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -3224,14 +3224,32 @@ declarations and assignments do not use a command. |vim9-declaration|
*:let=<<* *:let-heredoc*
*E990* *E991* *E172* *E221* *E1145*
-:let {var-name} =<< [trim] {endmarker}
+:let {var-name} =<< [trim] [eval] {endmarker}
text...
text...
{endmarker}
Set internal variable {var-name} to a |List|
containing the lines of text bounded by the string
- {endmarker}. The lines of text is used as a
- |literal-string|.
+ {endmarker}.
+
+ If "eval" is not specified, then each line of text is
+ used as a |literal-string|. If "eval" is specified,
+ then any Vim expression in the form ``={expr}`` is
+ evaluated and the result replaces the expression.
+ Example where $HOME is expanded: >
+ let lines =<< trim eval END
+ some text
+ See the file `=$HOME`/.vimrc
+ more text
+ END
+< There can be multiple Vim expressions in a single line
+ but an expression cannot span multiple lines. If any
+ expression evaluation fails, then the assignment fails.
+ once the "`=" has been found {expr} and a backtick
+ must follow. {expr} cannot be empty.
+ Currenty, in a compiled function {expr} is evaluated
+ when compiling the function, THIS WILL CHANGE.
+
{endmarker} must not contain white space.
{endmarker} cannot start with a lower case character.
The last line should end only with the {endmarker}
@@ -3281,6 +3299,13 @@ text...
1 2 3 4
5 6 7 8
DATA
+
+ let code =<< trim eval CODE
+ let v = `=10 + 20`
+ let h = "`=$HOME`"
+ let s = "`=Str1()` abc `=Str2()`"
+ let n = `=MyFunc(3, 4)`
+ CODE
<
*E121*
:let {var-name} .. List the value of variable {var-name}. Multiple