vim ags
vigation
_____ ____ ______
__ / ___/ ___/
/ __ _/ /_/ >___
(____ /___ /____ >
//_____/ /
適用於 silver searcher 或 ripgrep 的 Vim 插件,專注於
搜尋結果清晰顯示並輕鬆導航
透過pathogen、vundle、plug或複製到Vim目錄安裝
也必須安裝 ag 或 rg 可執行檔。
在搜尋結果視窗中查看文件或按u
(用於使用)。
儘管名稱vim-ags
但如果配置如下,也可以與ripgrep
一起使用:
let g: ags_agexe = ' rg '
let g: ags_agargs = {
' --column ' : [ ' ' , ' ' ],
' --line-number ' : [ ' ' , ' ' ],
' --context ' : [ ' g:ags_agcontext ' , ' -C ' ],
' --max-count ' : [ ' g:ags_agmaxcount ' , ' ' ],
' --heading ' : [ ' ' , ' ' ],
' --smart-case ' : [ ' ' , ' -S ' ],
' --color ' : [ ' always ' , ' ' ],
' --colors ' : [[ ' match:fg:green ' , ' match:bg:black ' , ' match:style:nobold ' , ' path:fg:red ' , ' path:style:bold ' , ' line:fg:black ' , ' line:style:bold ' ] , ' ' ],
}
" Search for the word under cursor
nnoremap <Leader> s :Ags <Space><C-R> =expand(' <cword> ') <CR><CR>
" Search for the visually selected text
vnoremap <Leader> s y:Ags <Space><C-R> ='"' . escape(@", '"*?()[]{}.') . '"' <CR><CR>
" Run Ags
nnoremap <Leader> a :Ags <Space>
" Quit Ags
nnoremap <Leader> <Leader> a :AgsQuit <CR>
適用於 ag 版本 >= 0.29.1 或 ripgrep >= 11.0.2
這是搜尋結果視窗的幾個螢幕截圖
控制鍵