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
这是搜索结果窗口的几个屏幕截图
控制键