Created
April 21, 2020 10:23
-
-
Save carbolymer/6bffdecb5afb426a1c24f80434e4d9be to your computer and use it in GitHub Desktop.
fff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" :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