Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fff
" :Rg with default search for cword
function! s:p(bang, ...)
let preview_window = get(g:, 'fzf_preview_window', a:bang && &columns >= 80 || &columns >= 120 ? 'right': '')
if len(preview_window)
return call('fzf#vim#with_preview', add(copy(a:000), preview_window))
endif
return {}
endfunction
function! s:callRipgrep(txt)
if empty(a:txt)
let l:searchString = expand('<cword>')
else
let l:searchString = a:txt
endif
call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(l:searchString), 1, s:p(!0), !0)
endfun
command! -bang -nargs=* Rg call s:callRipgrep(<q-args>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.