Skip to content

Instantly share code, notes, and snippets.

@hrfuller
Created April 3, 2020 18:48
Show Gist options
  • Save hrfuller/1c2a1a9838566cd7f87c9d6a0d7d77c8 to your computer and use it in GitHub Desktop.
Save hrfuller/1c2a1a9838566cd7f87c9d6a0d7d77c8 to your computer and use it in GitHub Desktop.
Setting up vim fzf with ripgrep
" need ripgrep and fzf installed. Both these plugins are needed by vim.
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
" Map ctrl-p to FZF
nnoremap <silent> <C-p> :GFiles <CR>
"Quick ripgrep word under cursor
command! -bang -nargs=0 RgCWord
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(expand('<cword>')), 1,
\ fzf#vim#with_preview(), <bang>0)
nnoremap <C-g> :RgCWord<CR>
@leporid
Copy link

leporid commented May 21, 2020

Do you make use of the leader mapping? Any reason not to use \ instead of Ctrl here? Both feel like maniobras de meñiques, anyways.

@hrfuller
Copy link
Author

hrfuller commented May 21, 2020

Wow never heard maniobras de meñiques before 😃. No reason not to use a different leader other than consistency with Ctrl-p for files search. You could change both of them to your preferred leader.

@leporid
Copy link

leporid commented May 22, 2020

Me exercising the pinky-finger's-worth of Spanish in my brain, and a healthy dictionary reliance. Thanks for the hot config tip, which I finally put into el .vimrc. Rg es sexi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment