aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/map.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/map.txt')
-rw-r--r--runtime/doc/map.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 2b2bfec6c7..ca1ddaabd4 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -905,6 +905,17 @@ or `unnamedplus`.
The `mode()` function will return the state as it will be after applying the
operator.
+Here is an example for using a lambda function to create a normal-mode
+operator to add quotes around text in the current line: >
+
+ nnoremap <F4> <Cmd>let &opfunc='{t ->
+ \ getline(".")
+ \ ->split("\\zs")
+ \ ->insert("\"", col("'']"))
+ \ ->insert("\"", col("''[") - 1)
+ \ ->join("")
+ \ ->setline(".")}'<CR>g@
+
==============================================================================
2. Abbreviations *abbreviations* *Abbreviations*