summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_ins_complete.vim
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2024-06-19 20:20:48 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-19 20:25:01 +0200
commit43eef882ff42e673af1e753892801ba20c5d002a (patch)
tree9af6e3ac6997ee065d8863553bc57a1f49c1fd73 /src/testdir/test_ins_complete.vim
parent94c5d8a5e20e1dd8c9e8434ee14e368276644f61 (diff)
patch 9.1.0503: cannot use fuzzy keyword completionv9.1.0503
Problem: cannot use fuzzy keyword completion (Maxim Kim) Solution: add the "fuzzycollect" value for the 'completeopt' setting, to gather matches using fuzzy logic (glepnir) fixes: #14912 closes: #14976 Signed-off-by: glepnir <glephunter@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_ins_complete.vim')
-rw-r--r--src/testdir/test_ins_complete.vim31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index 48589ce188..61c8ac7643 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -2586,6 +2586,37 @@ func Test_complete_fuzzy_match()
call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
call assert_equal('hello help hero h', getline('.'))
+ set completeopt=fuzzycollect
+ call setline(1, ['xyz yxz x'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('xyz yxz xyz', getline('.'))
+ " can fuzzy get yxz when use Ctrl-N twice
+ call setline(1, ['xyz yxz x'])
+ call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('xyz yxz yxz', getline('.'))
+
+ call setline(1, ['one two o'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('one two one', getline('.'))
+
+ call setline(1, ['你好 你'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('你好 你好', getline('.'))
+ call setline(1, ['你的 我的 的'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('你的 我的 你的', getline('.'))
+ " can fuzzy get multiple-byte word when use Ctrl-N twice
+ call setline(1, ['你的 我的 的'])
+ call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('你的 我的 我的', getline('.'))
+
+ "respect noinsert
+ set completeopt=fuzzycollect,menu,menuone,noinsert
+ call setline(1, ['one two o'])
+ call feedkeys("A\<C-X>\<C-N>", 'tx')
+ call assert_equal('one', g:word)
+ call assert_equal('one two o', getline('.'))
+
" clean up
set omnifunc=
bw!