summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-01 09:27:20 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-01 09:27:20 +0000
commit3d2e031d4f0e1559e4a4f99de5eb2330f38f8eb5 (patch)
tree281d80ef4a30e818d196cd870b7a3e05aaa49e5f /runtime
parentfad2742d538123abb9b384a053fd581f2acf6bb0 (diff)
downloadvim-git-3d2e031d4f0e1559e4a4f99de5eb2330f38f8eb5.tar.gz
patch 8.2.3710: Vim9: backtick expression expanded for :globalv8.2.3710
Problem: Vim9: backtick expression expanded for :global. Solution: Check the following command.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/vim9.txt14
1 files changed, 4 insertions, 10 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index dc39559c0..9329aa9c7 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1124,17 +1124,11 @@ function scope. Instead, use a lambda: >
return range(1, 2)->map((_, v) => list[v])
enddef
-The same is true for commands that are not compiled, such as `:global`.
-For these the backtick expansion can be used. Example: >
+For commands that are not compiled, such as `:edit`, backtick expansion can be
+used and it can use the local scope. Example: >
def Replace()
- var newText = 'blah'
- g/pattern/s/^/`=newText`/
- enddef
-
-Or a script variable can be used: >
- var newText = 'blah'
- def Replace()
- g/pattern/s/^/\=newText/
+ var fname = 'blah.txt'
+ edit `=fname`
enddef
Closures defined in a loop will share the same context. For example: >