diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-20 06:12:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-20 06:12:02 +0800 |
commit | e8618df7f826d2ca4d524f12fc712d7c52ea158c (patch) | |
tree | 4b1e84ade34a61efbaae47a356eee62bd02145a9 /runtime/doc/map.txt | |
parent | ebd57209018ed310836a8196ed4710e64a6d8ee5 (diff) | |
download | rneovim-e8618df7f826d2ca4d524f12fc712d7c52ea158c.tar.gz rneovim-e8618df7f826d2ca4d524f12fc712d7c52ea158c.tar.bz2 rneovim-e8618df7f826d2ca4d524f12fc712d7c52ea158c.zip |
vim-patch:8.2.3619: cannot use a lambda for 'operatorfunc' (#19846)
Problem: Cannot use a lambda for 'operatorfunc'.
Solution: Support using a lambda or partial. (Yegappan Lakshmanan,
closes vim/vim#8775)
https://github.com/vim/vim/commit/777175b0df8c5ec3cd30d19a2e887e661ac209c8
Omit duplicate docs. It's removed in patch 8.2.3623.
Nvim doesn't seem to need callback_set() as it was omitted when patch 8.1.1437
was first ported.
Diffstat (limited to 'runtime/doc/map.txt')
-rw-r--r-- | runtime/doc/map.txt | 11 |
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* |