diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua index af49f0b78c..7056d1baf5 100644 --- a/runtime/lua/vim/glob.lua +++ b/runtime/lua/vim/glob.lua @@ -96,7 +96,7 @@ local function end_seg(t) if t.n > 0 then seg_grammar.s = t.s for i = 1, t.n do - local rname = t[i][1] + local rname = '_' .. t[i][1] if not seg_grammar[rname] then -- Optimize search when deterministic first character is available if t[i].F then diff --git a/test/functional/lua/glob_spec.lua b/test/functional/lua/glob_spec.lua index 5ca38be62a..4792731c0c 100644 --- a/test/functional/lua/glob_spec.lua +++ b/test/functional/lua/glob_spec.lua @@ -67,6 +67,9 @@ describe('glob', function() eq(true, match('a*b*[cy]*d*e*', 'axbxcxdxexxx')) eq(true, match('a*b*[cy]*d*e*', 'axbxyxdxexxx')) eq(true, match('a*b*[cy]*d*e*', 'axbxxxyxdxexxx')) + eq(true, match('.ps*1', '.ps1')) + eq(true, match('.ps*1', '.psaa1')) + eq(false, match('.ps*1', '.ps1a')) end) it('should match ? wildcards', function()