aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/insert.txt
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-11-24 10:23:50 +0000
committerGitHub <noreply@github.com>2022-11-24 10:23:50 +0000
commit868d8d69627c4b8fd5225da0dff5905f75645946 (patch)
tree56f21690606a99140cfc2df4422626d56b1fca51 /runtime/doc/insert.txt
parentc9adbcafaec6c7aecb01e8f06a423a74b0a01116 (diff)
downloadrneovim-868d8d69627c4b8fd5225da0dff5905f75645946.tar.gz
rneovim-868d8d69627c4b8fd5225da0dff5905f75645946.tar.bz2
rneovim-868d8d69627c4b8fd5225da0dff5905f75645946.zip
vim-patch:partial:b59ae59a5870 (#21170)
Update runtime files https://github.com/vim/vim/commit/b59ae59a58706e454ef8c78276f021b1f58466e7 - Omit `map()` lambda arg comment. Not worth mentioning for legacy script (and is already hinted at below). - Cherry-pick latest `'thesaurusfunc'` example. - Skip `optwin.vim` `'keyprotocol'` change. - 🧜‍♀️ Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime/doc/insert.txt')
-rw-r--r--runtime/doc/insert.txt44
1 files changed, 21 insertions, 23 deletions
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 0133824e76..e25f5901ef 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -857,29 +857,27 @@ invoked and what it should return.
Here is an example that uses the "aiksaurus" command (provided by Magnus
Groß): >
- func Thesaur(findstart, base)
- if a:findstart
- let line = getline('.')
- let start = col('.') - 1
- while start > 0 && line[start - 1] =~ '\a'
- let start -= 1
- endwhile
- return start
- else
- let res = []
- let h = ''
- for l in split(system('aiksaurus ' .. shellescape(a:base)), '\n')
- if l[:3] == '=== '
- let h = substitute(l[4:], ' =*$', '', '')
- elseif l[0] =~ '\a'
- call extend(res, map(split(l, ', '), {_, val -> {'word': val, 'menu': '('.h.')'}}))
- endif
- endfor
- return res
- endif
- endfunc
-
- set thesaurusfunc=Thesaur
+ func Thesaur(findstart, base)
+ if a:findstart
+ return searchpos('\<', 'bnW', line('.'))[1] - 1
+ endif
+ let res = []
+ let h = ''
+ for l in systemlist('aiksaurus ' .. shellescape(a:base))
+ if l[:3] == '=== '
+ let h = '(' .. substitute(l[4:], ' =*$', ')', '')
+ elseif l ==# 'Alphabetically similar known words are: '
+ let h = "\U0001f52e"
+ elseif l[0] =~ '\a' || (h ==# "\U0001f52e" && l[0] ==# "\t")
+ call extend(res, map(split(substitute(l, '^\t', '', ''), ', '), {_, val -> {'word': val, 'menu': h}}))
+ endif
+ endfor
+ return res
+ endfunc
+
+ if exists('+thesaurusfunc')
+ set thesaurusfunc=Thesaur
+ endif
Completing keywords in the current and included files *compl-keyword*