Skip to content

Instantly share code, notes, and snippets.

@trufae
Created September 4, 2021 00:03
Show Gist options
  • Save trufae/c6e164f8c5156f000af488e23a2a0a89 to your computer and use it in GitHub Desktop.
Save trufae/c6e164f8c5156f000af488e23a2a0a89 to your computer and use it in GitHub Desktop.
if [ -f ~/.vim/autoload/plug.vim ]; then
echo "fzf-vim already installed."
else
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
cat >> ~/.vimrc <<EOF
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
call plug#end()
command! -bang -nargs=* GGrep
\ call fzf#vim#grep(
\ 'git grep --line-number -- '.shellescape(<q-args>), 0,
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
nmap <D-O> :GGrep<cr>
nmap <C-o> :FZF --layout=reverse<cr>
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment