mirror of
https://github.com/itme-brain/vim.git
synced 2026-05-08 07:30:13 -04:00
search fallback
This commit is contained in:
parent
770106343d
commit
e3b54f994a
1 changed files with 5 additions and 5 deletions
8
vimrc
8
vimrc
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue