Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit fcfa9d4

Browse files
committed
feat: matching with ignore case
1 parent 3bc48e8 commit fcfa9d4

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lua/completion/matching.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ local function fuzzy_score(str1, str2)
4545
end
4646

4747
local function fuzzy_match(prefix, word)
48+
if vim.g.completion_matching_ignore_case == 1 then
49+
prefix = string.lower(prefix)
50+
word = string.lower(word)
51+
end
4852
local score = fuzzy_score(prefix, word)
4953
if score < 1 then
5054
return true, score
@@ -55,6 +59,10 @@ end
5559

5660

5761
local function substring_match(prefix, word)
62+
if vim.g.completion_matching_ignore_case == 1 then
63+
prefix = string.lower(prefix)
64+
word = string.lower(word)
65+
end
5866
if string.find(word, prefix) then
5967
return true
6068
else
@@ -63,6 +71,10 @@ local function substring_match(prefix, word)
6371
end
6472

6573
local function exact_match(prefix, word)
74+
if vim.g.completion_matching_ignore_case == 1 then
75+
prefix = string.lower(prefix)
76+
word = string.lower(word)
77+
end
6678
if vim.startswith(word, prefix) then
6779
return true
6880
else

plugin/completion.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ if ! exists('g:completion_fuzzy_match')
7777
let g:completion_enable_fuzzy_match = 0
7878
endif
7979

80+
if ! exists('g:completion_matching_ignore_case')
81+
let g:completion_matching_ignore_case = 0
82+
endif
83+
8084
if ! exists('g:completion_matching_strategy_list')
8185
let g:completion_matching_strategy_list = ['exact']
8286
endif

0 commit comments

Comments
 (0)