aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-07-31 00:20:20 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-16 00:13:41 +0100
commit9e38c4a79fe0351e9e18bc57cf48b960e8d31e88 (patch)
treea0ba140fd2bf69e6a85ef7e76b3a7b51a76f0f55 /runtime/doc
parentffaf881b42fd22b8bf423c5754d48ce93f59bf4b (diff)
downloadrneovim-9e38c4a79fe0351e9e18bc57cf48b960e8d31e88.tar.gz
rneovim-9e38c4a79fe0351e9e18bc57cf48b960e8d31e88.tar.bz2
rneovim-9e38c4a79fe0351e9e18bc57cf48b960e8d31e88.zip
vim-patch:8.2.1473: items in a list given to :const can still be modified
Problem: Items in a list given to :const can still be modified. Solution: Work like ":lockvar! name" but don't lock referenced items. Make locking a blob work. https://github.com/vim/vim/commit/021bda56710d98c09a6b35610a476ab2dd8c58ad
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/eval.txt14
1 files changed, 11 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7532bcfba7..7f22bab7f2 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -10871,10 +10871,18 @@ text...
:const x = 1
< is equivalent to: >
:let x = 1
- :lockvar 1 x
+ :lockvar! x
< This is useful if you want to make sure the variable
- is not modified.
- *E995*
+ is not modified. If the value is a List or Dictionary
+ literal then the items also cannot be changed: >
+ const ll = [1, 2, 3]
+ let ll[1] = 5 " Error!
+< Nested references are not locked: >
+ let lvar = ['a']
+ const lconst = [0, lvar]
+ let lconst[0] = 2 " Error!
+ let lconst[1][0] = 'b' " OK
+< *E995*
|:const| does not allow to for changing a variable. >
:let x = 1
:const x = 2 " Error!