aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-19 08:03:13 +0800
committerGitHub <noreply@github.com>2023-01-19 08:03:13 +0800
commitf8669e8a181abad98229d97439a9cafe8c32fc06 (patch)
tree14f7d4072f058b5a96cb6f517276b2e40aaaa8ca /runtime
parent42d5142367c375be5cbdfbf11d150a5ebe8c30d6 (diff)
downloadrneovim-f8669e8a181abad98229d97439a9cafe8c32fc06.tar.gz
rneovim-f8669e8a181abad98229d97439a9cafe8c32fc06.tar.bz2
rneovim-f8669e8a181abad98229d97439a9cafe8c32fc06.zip
vim-patch:8.2.1698: cannot lock a variable in legacy Vim script like in Vim9 (#21883)
Problem: Cannot lock a variable in legacy Vim script like in Vim9. Solution: Make ":lockvar 0" work. https://github.com/vim/vim/commit/a187c43cfe8863d48b2159d695fedcb71f8525c1 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 0ac8152144..58759a6053 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2681,6 +2681,8 @@ text...
[depth] is relevant when locking a |List| or
|Dictionary|. It specifies how deep the locking goes:
+ 0 Lock the variable {name} but not its
+ value.
1 Lock the |List| or |Dictionary| itself,
cannot add or remove items, but can
still change their values.
@@ -2694,7 +2696,14 @@ text...
|Dictionary|, one level deeper.
The default [depth] is 2, thus when {name} is a |List|
or |Dictionary| the values cannot be changed.
- *E743*
+
+ Example with [depth] 0: >
+ let mylist = [1, 2, 3]
+ lockvar 0 mylist
+ let mylist[0] = 77 " OK
+ call add(mylist, 4] " OK
+ let mylist = [7, 8, 9] " Error!
+< *E743*
For unlimited depth use [!] and omit [depth].
However, there is a maximum depth of 100 to catch
loops.