search fallback

This commit is contained in:
Bryan Ramos 2026-05-07 11:25:36 -04:00
parent 770106343d
commit e3b54f994a

8
vimrc
View file

@ -161,14 +161,14 @@ function! FzfRg()
echohl WarningMsg | echom 'No project search command is available' | echohl None echohl WarningMsg | echom 'No project search command is available' | echohl None
return return
endif endif
execute 'lcd ' . fnameescape(GitRoot())
if executable('rg') && exists(':Rg') == 2
Rg
else
let l:query = input('Search: ') let l:query = input('Search: ')
if empty(l:query) if empty(l:query)
return return
endif endif
execute 'lcd ' . fnameescape(GitRoot())
if executable('rg') && exists(':Rg') == 2
execute 'Rg ' . escape(l:query, '|')
else
let l:results = system('grep -RIn -e ' . shellescape(l:query) . ' . 2>/dev/null') let l:results = system('grep -RIn -e ' . shellescape(l:query) . ' . 2>/dev/null')
if empty(l:results) if empty(l:results)
echohl WarningMsg | echom 'No matches found' | echohl None echohl WarningMsg | echom 'No matches found' | echohl None