diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-14 19:45:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-15 17:40:31 +0800 |
commit | 3ad8c08acc506555667a070cf83c410ac9334f1e (patch) | |
tree | 7084012f51be3bad6726e5de6f79f7740bf2e104 /runtime/doc/eval.txt | |
parent | 071c455420dec7992a06a55e8bd443b769ded369 (diff) | |
download | rneovim-3ad8c08acc506555667a070cf83c410ac9334f1e.tar.gz rneovim-3ad8c08acc506555667a070cf83c410ac9334f1e.tar.bz2 rneovim-3ad8c08acc506555667a070cf83c410ac9334f1e.zip |
vim-patch:8.2.4770: cannot easily mix expression and heredoc
Problem: Cannot easily mix expression and heredoc.
Solution: Support in heredoc. (Yegappan Lakshmanan, closes vim/vim#10138)
https://github.com/vim/vim/commit/efbfa867a146fcd93fdec2435597aa4ae7f1325c
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 351690f4df..c8eea03f5f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2540,14 +2540,30 @@ This does NOT work: > *: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. + {endmarker} must not contain white space. {endmarker} cannot start with a lower case character. The last line should end only with the {endmarker} @@ -2597,6 +2613,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 |