Migrate from the silver searcher to ripgrep

This commit is contained in:
hophacker 2019-04-10 17:53:39 +08:00
parent 07bdfb749c
commit a0bfa3f963
8 changed files with 31 additions and 31 deletions

View File

@ -86,7 +86,7 @@ rake update
Homebrew是_缺失了的OSX包管理系统_它会被自动安装。
我们自动安装了一些常用的包例如ctags, git, macvim, hub, 以及silver searcher ('ag')。
我们自动安装了一些常用的包例如ctags, git, macvim, hub, 以及RipGrep ('rg')。
注意我们的自动补全插件需要MacVim支持Lua。安装器知道如何安装但如果你以前安装过你需要手动删除你以前的MacVim。
### ZSH
@ -194,7 +194,7 @@ YADR会接管你的`~/.gitconfig`, 所以如果你想存储你的git用户名及
* `,K` - Grep当前单词一直到下一个感叹号(在ruby foo!方法中很有用)
* `Cmd-*` - 将所有当前单词出现的地方高亮(与正常的`*`一样,除了不移动)
* `,hl` - 切换搜索高亮
* `,gg``,ag` - 在命令行中grep在双引号之间输入。 使用 Ag(Silver Searcher)
* `,gg``,ag` - 在命令行中grep在双引号之间输入。 使用RipGrep
* 在使用`,gg`搜索过,你可以用`Ctrl-x` 和 `Ctrl-z`来浏览 (或者标准vim命令 `:cn``:cp`)
* `,gd` - 当光标在函数名字上的时候Grep定义 (检索'def [function name]')
* `,gcf` - 在当前文件搜索对当前文件的索引

View File

@ -200,7 +200,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 the_silver_searcher ghi hub}
run %{brew install zsh ctags git hub tmux reattach-to-user-namespace ripgrep ghi hub}
run %{brew install macvim --custom-icons --with-override-system-vim --with-lua --with-luajit}
puts
puts

View File

@ -1,14 +1,14 @@
* SplitJoin - easily split up things like ruby hashes into multiple lines or join them back together. Try :SplitjoinJoin and :SplitjoinSplit or use the bindings sj(split) and sk(unsplit) - mnemonically j and k are directions down and up
* tabularize - align code effortlessly by using :Tabularize /[character] to align by a character, or try the keymaps
* yankring - effortless sanity for pasting. every time you yank something it goes into a buffer. after hitting p to paste, use ctrl-p or ctrl-n to cycle through the paste options. great for when you accidentally overwrite your yank with a delete.
* surround - super easy quote and tag manipulation - ysiw" - sourround inner word with quotes. ci"' - change inner double quotes to single quotes, etc
* greplace - use :Gsearch to find across many files, replace inside the changes, then :Greplace to do a replace across all matches - made lightning fast with Silver Searcher
* vim-markdown-preview - :Mm to view your README.md as html
* html-escape - ,he and ,hu to escape and unescape html
* Gundo - visualize your undos - pretty amazing plugin. Hit ,u with my keymappings to trigger it, very user friendly
* vim-indent-guides - visual indent guides, off by default
* 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)
* 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
* * tabularize - align code effortlessly by using :Tabularize /[character] to align by a character, or try the keymaps
* * yankring - effortless sanity for pasting. every time you yank something it goes into a buffer. after hitting p to paste, use ctrl-p or ctrl-n to cycle through the paste options. great for when you accidentally overwrite your yank with a delete.
* * surround - super easy quote and tag manipulation - ysiw" - sourround inner word with quotes. ci"' - change inner double quotes to single quotes, etc
* * greplace - use :Gsearch to find across many files, replace inside the changes, then :Greplace to do a replace across all matches - made lightning fast with Silver Searcher
* * vim-markdown-preview - :Mm to view your README.md as html
* * html-escape - ,he and ,hu to escape and unescape html
* * Gundo - visualize your undos - pretty amazing plugin. Hit ,u with my keymappings to trigger it, very user friendly
* * vim-indent-guides - visual indent guides, off by default
* * 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.
* * vim-session: use `:SaveSession` and `:OpenSession` to come back to your saved window layout'

View File

@ -1,3 +0,0 @@
" Open the Ag command and place the cursor into the quotes
nmap ,ag :Ag ""<Left>
nmap ,af :AgFile ""<Left>

View File

@ -1,11 +1,11 @@
if exists("g:ctrlp_user_command")
unlet g:ctrlp_user_command
endif
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$"'
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'
" ag is fast enough that CtrlP doesn't need to cache
" rg is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
else
" Fall back to using git ls-files if Ag is not available

3
vim/settings/ripgrep.vim Normal file
View File

@ -0,0 +1,3 @@
" Open the Rg command and place the cursor into the quotes
nmap ,rg :Rg ""<Left>
nmap ,rf :Rg --files ""<Left>

View File

@ -11,20 +11,20 @@ function! GetVisual()
endfunction
"grep the current word using ,k (mnemonic Kurrent)
nnoremap <silent> ,k :Ag <cword><CR>
nnoremap <silent> ,k :Rg <cword><CR>
"grep visual selection
vnoremap ,k :<C-U>execute "Ag " . GetVisual()<CR>
vnoremap ,k :<C-U>execute "Rg " . GetVisual()<CR>
"grep current word up to the next exclamation point using ,K
nnoremap ,K viwf!:<C-U>execute "Ag " . GetVisual()<CR>
nnoremap ,K viwf!:<C-U>execute "Rg " . GetVisual()<CR>
"grep for 'def foo'
nnoremap <silent> ,gd :Ag 'def <cword>'<CR>
nnoremap <silent> ,gd :Rg 'def <cword>'<CR>
",gg = Grep! - using Ag the silver searcher
",gg = Grep! - using Rg RipGrep"
" open up a grep line, with a quote started for the search
nnoremap ,gg :Ag ""<left>
nnoremap ,gg :Rg ""<left>
"Grep for usages of the current file
nnoremap ,gcf :exec "Ag " . expand("%:t:r")<CR>
nnoremap ,gcf :exec "Rg " . expand("%:t:r")<CR>

View File

@ -1,5 +1,5 @@
Bundle "justinmk/vim-sneak"
Bundle "rking/ag.vim"
Bundle "jremmen/vim-ripgrep"
Bundle "henrik/vim-indexed-search"
Bundle "nelstrom/vim-visual-star-search"
Bundle "dkprice/vim-easygrep"