/README.md

https://github.com/gabesoft/vim-ags · Markdown · 62 lines · 51 code · 11 blank · 0 comment · 0 complexity · de8797d87c5f2d165c248a9a810471e8 MD5 · raw file

  1. ```
  2. _____ ____ ______
  3. \__ \ / ___\/ ___/
  4. / __ \_/ /_/ >___ \
  5. (____ /\___ /____ >
  6. \//_____/ \/
  7. ```
  8. # Silver searcher (AG) plugin for Vim
  9. *A Vim plugin for the [silver searcher](https://github.com/ggreer/the_silver_searcher) or [ripgrep](https://github.com/BurntSushi/ripgrep) that focuses on
  10. clear display and easy navigation of the search results*
  11. ### Installation
  12. Install via [pathogen](https://github.com/tpope/vim-pathogen), [vundle](https://github.com/gmarik/vundle), [plug](https://github.com/junegunn/vim-plug) or copy to the Vim directory
  13. The [ag](https://github.com/ggreer/the_silver_searcher) or [rg](https://github.com/BurntSushi/ripgrep) executable must be installed as well.
  14. ### Usage
  15. See the [docs](https://github.com/gabesoft/vim-ags/blob/master/doc/ags.txt) or press `u` (for usage) while in the search results window.
  16. ### Using [ripgrep](https://github.com/BurntSushi/ripgrep) instead of [ag](https://github.com/ggreer/the_silver_searcher)
  17. Despite the name `vim-ags` works with `ripgrep` as well if configured as below:
  18. ```vim
  19. let g:ags_agexe = 'rg'
  20. let g:ags_agargs = {
  21. \ '--column' : ['', ''],
  22. \ '--line-number' : ['', ''],
  23. \ '--context' : ['g:ags_agcontext', '-C'],
  24. \ '--max-count' : ['g:ags_agmaxcount', ''],
  25. \ '--heading' : ['',''],
  26. \ '--smart-case' : ['','-S'],
  27. \ '--color' : ['always',''],
  28. \ '--colors' : [['match:fg:green', 'match:bg:black', 'match:style:nobold', 'path:fg:red', 'path:style:bold', 'line:fg:black', 'line:style:bold'] ,''],
  29. \ }
  30. ```
  31. ### Sample Shortcut Mappings
  32. ```vim
  33. " Search for the word under cursor
  34. nnoremap <Leader>s :Ags<Space><C-R>=expand('<cword>')<CR><CR>
  35. " Search for the visually selected text
  36. vnoremap <Leader>s y:Ags<Space><C-R>='"' . escape(@", '"*?()[]{}.') . '"'<CR><CR>
  37. " Run Ags
  38. nnoremap <Leader>a :Ags<Space>
  39. " Quit Ags
  40. nnoremap <Leader><Leader>a :AgsQuit<CR>
  41. ```
  42. ### Notes
  43. Works with ag version >= 0.29.1 or ripgrep >= 11.0.2
  44. ### Screenshots
  45. Here are a couple of screenshots of the search results window
  46. #### View mode (with [lightline](https://github.com/itchyny/lightline.vim) integration)
  47. <img src="https://github.com/gabesoft/vim-ags/raw/master/assets/screen-shot8.png" />
  48. #### Edit mode
  49. <img src="https://github.com/gabesoft/vim-ags/raw/master/assets/screen-shot6-edit-mode.png" />
  50. ### Similar Plugins
  51. [ctrlsf](https://github.com/dyng/ctrlsf.vim)