aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-14 21:08:00 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-15 17:59:32 +0800
commitbacb5021d4eff33c67eb659fb01125b2abcacd79 (patch)
tree553983c2a337c8183899bd3f33abb84033bce5fc /runtime
parent2cf8f01e7d0469b592bacecd5f224b4fe3149a62 (diff)
downloadrneovim-bacb5021d4eff33c67eb659fb01125b2abcacd79.tar.gz
rneovim-bacb5021d4eff33c67eb659fb01125b2abcacd79.tar.bz2
rneovim-bacb5021d4eff33c67eb659fb01125b2abcacd79.zip
vim-patch:8.2.4883: string interpolation only works in heredoc
Problem: String interpolation only works in heredoc. Solution: Support interpolated strings. Use syntax for heredoc consistent with strings, similar to C#. (closes vim/vim#10327) https://github.com/vim/vim/commit/2eaef106e4a7fc9dc74a7e672b5f550ec1f9786e Cherry-pick Test_Debugger_breakadd_expr() from Vim. Co-authored-by: LemonBoy <thatlemon@gmail.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index c8eea03f5f..518a190d3c 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1407,6 +1407,26 @@ to be doubled. These two commands are equivalent: >
------------------------------------------------------------------------------
+interpolated-string *interp-string*
+
+$"string" interpolated string constant *expr-$quote*
+$'string' interpolated literal string constant *expr-$'*
+
+Interpolated strings are an extension of the |string| and |literal-string|,
+allowing the inclusion of Vim script expressions (see |expr1|). Any
+expression returning a value can be enclosed between curly braces. The value
+is converted to a string. All the text and results of the expressions
+are concatenated to make a new string.
+
+To include an opening brace '{' or closing brace '}' in the string content
+double it.
+
+Examples: >
+ let your_name = input("What's your name? ")
+ echo $"Hello, {your_name}!"
+ echo $"The square root of 9 is {sqrt(9)}"
+
+------------------------------------------------------------------------------
option *expr-option* *E112* *E113*
&option option value, local value if possible