mirror of
https://github.com/jremmen/vim-ripgrep.git
synced 2025-12-27 04:04:58 +08:00
Merge 0ebd07d01d into 2bb2425387
This commit is contained in:
commit
7373f203df
2 changed files with 19 additions and 11 deletions
23
README.md
23
README.md
|
|
@ -1,6 +1,8 @@
|
|||
# vim-ripgrep
|
||||
|
||||
:Rg <string|pattern>
|
||||
```vim
|
||||
:Rg <string|pattern>
|
||||
```
|
||||
|
||||
Word under cursor will be searched if no argument is passed to `Rg`
|
||||
|
||||
|
|
@ -9,16 +11,19 @@ Word under cursor will be searched if no argument is passed to `Rg`
|
|||
|
||||
| Setting | Default | Details
|
||||
| ---------------------|---------------------------|----------
|
||||
| g:rg_binary | rg | path to rg
|
||||
| g:rg_format | %f:%l:%c:%m | value of grepformat
|
||||
| g:rg_command | g:rg_binary --vimgrep | search command
|
||||
| g:rg_highlight | false | true if you want matches highlighted
|
||||
| g:rg_derive_root | false | true if you want to find project root from cwd
|
||||
| g:rg_root_types | ['.git'] | list of files/dir found in project root
|
||||
| g:rg_window_location | botright | quickfix window location
|
||||
| `g:rg_binary` | `rg` | path to the `rg` binary
|
||||
| `g:rg_format` | `%f:%l:%c:%m` | value of `grepformat `
|
||||
| `g:rg_command` | `g:rg_binary --vimgrep` | search command
|
||||
| `g:rg_highlight` | `false` | true if you want matches highlighted
|
||||
| `g:rg_highlight_type` | `identifier` | if `rg_highlight` is set, use this syntax color to highlight the result
|
||||
| `g:rg_derive_root` | `false` | true if you want to find project root from cwd
|
||||
| `g:rg_root_types` | `['.git']` | list of files/dir found in project root
|
||||
| `g:rg_window_location` | `botright` | quickfix window location
|
||||
|
||||
## misc
|
||||
|
||||
Show root search dir
|
||||
|
||||
:RgRoot
|
||||
```vim
|
||||
:RgRoot
|
||||
```
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ if !exists('g:rg_window_location')
|
|||
let g:rg_window_location = 'botright'
|
||||
endif
|
||||
|
||||
if !exists('g:rg_highlight_type')
|
||||
let g:rg_highlight_type = 'keyword'
|
||||
endif
|
||||
|
||||
fun! g:RgVisual() range
|
||||
call s:RgGrepContext(function('s:RgSearch'), '"' . s:RgGetVisualSelection() . '"')
|
||||
endfun
|
||||
|
|
@ -110,8 +114,7 @@ fun! s:RgPathContext(search, txt)
|
|||
endfun
|
||||
|
||||
fun! s:RgHighlight(txt)
|
||||
let @/=escape(substitute(a:txt, '"', '', 'g'), '|')
|
||||
call feedkeys(":let &hlsearch=1\<CR>", 'n')
|
||||
call matchadd(g:rg_highlight_type, a:txt)
|
||||
endfun
|
||||
|
||||
fun! s:RgRootDir()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue