From e5a1358508ca45bc10fdd343c38c00cb8be8cd1f Mon Sep 17 00:00:00 2001 From: Yan Pritzker Date: Tue, 30 May 2017 16:40:31 -0500 Subject: [PATCH] Revert "Migrate from the silver searcher to ripgrep" --- README.md | 4 ++-- Rakefile | 2 +- doc/vim/utils.md | 2 +- vim/settings/ctrlp.vim | 12 +++--------- vim/settings/grep.vim | 5 ++--- vim/settings/ripgrep.vim | 3 --- vim/settings/search.vim | 14 +++++++------- vim/vundles/search.vundle | 2 +- 8 files changed, 17 insertions(+), 27 deletions(-) delete mode 100644 vim/settings/ripgrep.vim diff --git a/README.md b/README.md index ba447dcd..a9c59f5f 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Read on to learn what YADR provides! Homebrew is _the missing package manager for OSX_. Installed automatically. -We automatically install a few useful packages including ctags, git, macvim, hub, and RipGrep ('rg') +We automatically install a few useful packages including ctags, git, macvim, hub, and the silver searcher ('ag') Note that our autocomplete plugin requires a MacVim that supports Lua. The installer knows how to install it, but if you had one installed before, you may need to manually remove your old MacVim. ### ZSH @@ -192,7 +192,7 @@ of plugins above to learn more. * `,K` - Grep the current word up to next exclamation point (useful for ruby foo! methods) * `Cmd-*` - highlight all occurrences of current word (similar to regular `*` except doesn't move) * `,hl` - toggle search highlight on and off - * `,gg` or `,rg` - Grep command line, type between quotes. Uses RipGrep. + * `,gg` or `,ag` - Grep command line, type between quotes. Uses Ag Silver Searcher. * After searching with `,gg` you can navigate the results with `Ctrl-x` and `Ctrl-z` (or standard vim `:cn` and `:cp`) * `,gd` - Grep def (greps for 'def [function name]') when cursor is over the function name * `,gcf` - Grep Current File to find references to the current file diff --git a/Rakefile b/Rakefile index c930b38a..3c1d29d0 100644 --- a/Rakefile +++ b/Rakefile @@ -172,7 +172,7 @@ def install_homebrew puts "======================================================" puts "Installing Homebrew packages...There may be some warnings." puts "======================================================" - run %{brew install zsh ctags git hub tmux reattach-to-user-namespace ripgrep ghi hub} + run %{brew install zsh ctags git hub tmux reattach-to-user-namespace the_silver_searcher ghi hub} run %{brew install macvim --custom-icons --with-override-system-vim --with-lua --with-luajit} puts puts diff --git a/doc/vim/utils.md b/doc/vim/utils.md index 591fe423..078a96b1 100644 --- a/doc/vim/utils.md +++ b/doc/vim/utils.md @@ -10,5 +10,5 @@ * color_highlight - use :ColorCodes to see hex colors highlighted * change-inside-surroundings - change content inside delimiters like quotes/brackets * rspec.vim - used for color highlighting rspec correctly even if specs live outside of spec/ (rails.vim doesn't handle this) -* Rg - use :Rg to search across multiple files. Faster than Ag, Grep and Ack. +* Ag - use :Ag to search across multiple files. Faster than Grep and Ack. * vim-session: use `:SaveSession` and `:OpenSession` to come back to your saved window layout diff --git a/vim/settings/ctrlp.vim b/vim/settings/ctrlp.vim index 5d762740..04e4de8e 100644 --- a/vim/settings/ctrlp.vim +++ b/vim/settings/ctrlp.vim @@ -1,16 +1,10 @@ if exists("g:ctrlp_user_command") unlet g:ctrlp_user_command endif - -if executable('rg') - " Use rg in CtrlP for listing files. Lightning fast and respects .gitignore - let g:ctrlp_user_command = 'rg --files --smart-case %s' - - " rg is fast enough that CtrlP doesn't need to cache - let g:ctrlp_use_caching = 0 -elseif executable('ag') +if executable('ag') " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore - let g:ctrlp_user_command = 'ag %s --files-with-matches -g "" --ignore "\.git$\|\.hg$\|\.svn$"' + let g:ctrlp_user_command = + \ 'ag %s --files-with-matches -g "" --ignore "\.git$\|\.hg$\|\.svn$"' " ag is fast enough that CtrlP doesn't need to cache let g:ctrlp_use_caching = 0 diff --git a/vim/settings/grep.vim b/vim/settings/grep.vim index f400d84e..08c7fd09 100644 --- a/vim/settings/grep.vim +++ b/vim/settings/grep.vim @@ -1,4 +1,3 @@ -"Use RipGrep for lightning fast Gsearch command -set grepprg=rg\ --vimgrep\ --no-heading -set grepformat=%f:%l:%c:%m,%f:%l:%m +"Use the silver searcher for lightning fast Gsearch command +set grepprg=git\ grep let g:grep_cmd_opts = '--line-number' diff --git a/vim/settings/ripgrep.vim b/vim/settings/ripgrep.vim deleted file mode 100644 index ccece01f..00000000 --- a/vim/settings/ripgrep.vim +++ /dev/null @@ -1,3 +0,0 @@ -" Open the Rg command and place the cursor into the quotes -nmap ,rg :Rg "" -nmap ,rf :Rg --files "" diff --git a/vim/settings/search.vim b/vim/settings/search.vim index 4be724e2..82cf075b 100644 --- a/vim/settings/search.vim +++ b/vim/settings/search.vim @@ -11,20 +11,20 @@ function! GetVisual() endfunction "grep the current word using ,k (mnemonic Kurrent) -nnoremap ,k :Rg +nnoremap ,k :Ag "grep visual selection -vnoremap ,k :execute "Rg " . GetVisual() +vnoremap ,k :execute "Ag " . GetVisual() "grep current word up to the next exclamation point using ,K -nnoremap ,K viwf!:execute "Rg " . GetVisual() +nnoremap ,K viwf!:execute "Ag " . GetVisual() "grep for 'def foo' -nnoremap ,gd :Rg 'def ' +nnoremap ,gd :Ag 'def ' -",gg = Grep! - using Rg RipGrep +",gg = Grep! - using Ag the silver searcher " open up a grep line, with a quote started for the search -nnoremap ,gg :Rg "" +nnoremap ,gg :Ag "" "Grep for usages of the current file -nnoremap ,gcf :exec "Rg " . expand("%:t:r") \ No newline at end of file +nnoremap ,gcf :exec "Ag " . expand("%:t:r") diff --git a/vim/vundles/search.vundle b/vim/vundles/search.vundle index 43dc2bf3..2635f88d 100644 --- a/vim/vundles/search.vundle +++ b/vim/vundles/search.vundle @@ -1,5 +1,5 @@ Bundle "justinmk/vim-sneak" -Bundle "jremmen/vim-ripgrep" +Bundle "rking/ag.vim" Bundle "henrik/vim-indexed-search" Bundle "nelstrom/vim-visual-star-search" Bundle "skwp/greplace.vim"