From 43eef882ff42e673af1e753892801ba20c5d002a Mon Sep 17 00:00:00 2001 From: glepnir Date: Wed, 19 Jun 2024 20:20:48 +0200 Subject: patch 9.1.0503: cannot use fuzzy keyword completion 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 Signed-off-by: Christian Brabandt --- src/testdir/test_ins_complete.vim | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/testdir/test_ins_complete.vim') 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\\\0", 'tx!') call assert_equal('hello help hero h', getline('.')) + set completeopt=fuzzycollect + call setline(1, ['xyz yxz x']) + call feedkeys("A\\\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\\\\0", 'tx!') + call assert_equal('xyz yxz yxz', getline('.')) + + call setline(1, ['one two o']) + call feedkeys("A\\\0", 'tx!') + call assert_equal('one two one', getline('.')) + + call setline(1, ['你好 你']) + call feedkeys("A\\\0", 'tx!') + call assert_equal('你好 你好', getline('.')) + call setline(1, ['你的 我的 的']) + call feedkeys("A\\\0", 'tx!') + call assert_equal('你的 我的 你的', getline('.')) + " can fuzzy get multiple-byte word when use Ctrl-N twice + call setline(1, ['你的 我的 的']) + call feedkeys("A\\\\0", 'tx!') + call assert_equal('你的 我的 我的', getline('.')) + + "respect noinsert + set completeopt=fuzzycollect,menu,menuone,noinsert + call setline(1, ['one two o']) + call feedkeys("A\\", 'tx') + call assert_equal('one', g:word) + call assert_equal('one two o', getline('.')) + " clean up set omnifunc= bw! -- cgit v1.2.3