Skip to content

Commit 5fc7aef

Browse files
committed
Remove leading ./ in include/exclude config
1 parent 4a0c674 commit 5fc7aef

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

autoload/project/find_in_files.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,7 @@ function! s:GetRgCmd(pattern, flags)
493493
call filter(include, {_, val -> val != '.'})
494494

495495
if len(include)
496-
let include_pattern = map(include,
497-
\{_, val -> val.'/**' })
496+
let include_pattern = map(include, {_, val -> val.'/**' })
498497
let include_arg = '-g "{'.join(include_pattern, ',').'}"'
499498
else
500499
let include_arg = '-g "{**}"'
@@ -630,6 +629,10 @@ function! s:GetSearchFlags(search)
630629
return flags
631630
endfunction
632631

632+
function! s:RemoveLeadingDot(val)
633+
return substitute(a:val, '^./\?', '', 'g')
634+
endfunction
635+
633636
function! s:RemoveSearchFlags(search)
634637
return substitute(a:search, '\\C\|\\E\|\\\@<!\\$', '', 'g')
635638
endfunction
@@ -680,9 +683,11 @@ function! s:ReplaceEscapedChar(chars, idx, char, from, to)
680683
endfunction
681684

682685
function! s:GetInclude()
683-
return copy(project#GetVariable('find_in_files_include'))
686+
let include = copy(project#GetVariable('find_in_files_include'))
687+
return map(include, {_, val -> s:RemoveLeadingDot(val)})
684688
endfunction
685689

686690
function! s:GetExclude()
687-
return copy(project#GetVariable('find_in_files_exclude'))
691+
let exclude = copy(project#GetVariable('find_in_files_exclude'))
692+
return map(exclude, {_, val -> s:RemoveLeadingDot(val)})
688693
endfunction

0 commit comments

Comments
 (0)