From 61e1360821a80df92ee6563885a5a26d70c0ae19 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sun, 4 Sep 2022 02:18:23 -0400 Subject: [PATCH] add fzf text finder function --- .vimrc.bundles | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index 2457228..a3464df 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -65,7 +65,9 @@ Plug 'vim-scripts/restore_view.vim' if executable('fzf') - Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + " fzf#install() makes sure that you have the latest binary, comment out because I don't want it to install binary for me + Plug 'junegunn/fzf' ", { 'do': { -> fzf#install() } } + Plug 'junegunn/fzf.vim' endif Plug 'NLKNguyen/papercolor-theme' @@ -131,7 +133,7 @@ if g:vim_type == 'nvim' endif endif " } - + " airblade/vim-rooter { if isdirectory(expand(plugin_dir . "/vim-rooter")) let g:rooter_patterns = ['.vscode', '.git'] @@ -190,12 +192,29 @@ endif " } "endif - " junegunnjunegunn/fzf { + " junegunn/fzf { " [Buffers] Jump to the existing window if possible let g:fzf_buffers_jump = 1 - "let $FZF_DEFAULT_COMMAND = 'find -L' - let $FZF_DEFAULT_COMMAND='find . \( -name node_modules -o -name .git \) -prune -o -print' - noremap f :FZF + + "let $FZF_DEFAULT_COMMAND='find . \( -name node_modules -o -name .git \) -prune -o -print' + + " - Preview window on the right with 50% width + " - CTRL-/ will toggle preview window. + let g:fzf_preview_window = ['right:50%', 'ctrl-/'] + + noremap f :Files + + + command! -bang -nargs=* Rrg + \ call fzf#vim#grep( + \ 'grep -R --line-number --exclude-dir=".git;.svn" --color=always -- '.shellescape(), 1, + \ fzf#vim#with_preview(), 0) + " check if ripgrep is installed + if executable('rg') + noremap rg :Rg + else + noremap rg :Rrg + endif " } " neoclide/coc.nvim {