diff --git a/.vimrc b/.vimrc index c3632ca..fe59dc8 100644 --- a/.vimrc +++ b/.vimrc @@ -165,19 +165,20 @@ let g:fzf_colors = " https://medium.com/@crashybang/supercharge-vim-with-fzf-and-ripgrep-d4661fc853d2 command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --color "always" '.shellescape().'| tr -d "\017"', 1, 0) -" Alternative, not enabled for the moment, as it also searches part of the -" file name +" Search contents of files with ripgrep +" https://sidneyliebrand.io/blog/how-fzf-and-ripgrep-improved-my-workflow command! -bang -nargs=* Rg \ call fzf#vim#grep( - \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(), 1, - \ 0 ? fzf#vim#with_preview('up:60%') - \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ 'rg --column --line-number --hidden --smart-case --no-heading --color=always '.shellescape(), 1, + \ 0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%') + \ : fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'right:50%:hidden', '?'), \ 0) " Files command with preview window command! -bang -nargs=? -complete=dir FilesPreview \ call fzf#vim#files(, fzf#vim#with_preview(), 0) +" Mapping the above functions to more easily accessible hotkeys. " Simply type ; to search through buffers, leader-o to search through file " names, leader-O to search through file names, showing a preview window, " \t for tags, \c for (Git) commits and \f to search through contents of files @@ -186,8 +187,10 @@ nmap o :Files nmap O :FilesPreview nmap t :Tags nmap c :Commits -nmap f :Find +" nmap f :Find +nmap f :Rg nmap l :Lines +" nmap g :Rg nnoremap [f :lprevious nnoremap ]f :lnext