Mercurial > vim
diff runtime/doc/map.txt @ 26175:6b4f017d7005 v8.2.3619
patch 8.2.3619: cannot use a lambda for 'operatorfunc'
Commit: https://github.com/vim/vim/commit/777175b0df8c5ec3cd30d19a2e887e661ac209c8
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Thu Nov 18 22:08:57 2021 +0000
patch 8.2.3619: cannot use a lambda for 'operatorfunc'
Problem: Cannot use a lambda for 'operatorfunc'.
Solution: Support using a lambda or partial. (Yegappan Lakshmanan,
closes #8775)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 18 Nov 2021 23:15:04 +0100 |
parents | 624439a39432 |
children | 9865f996a3c0 |
line wrap: on
line diff
--- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1009,6 +1009,20 @@ or `unnamedplus`. The `mode()` function will return the state as it will be after applying the operator. +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*