search fallback

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

10
vimrc
View file

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