|
| 1 | +# Grug Far |
| 2 | + |
| 3 | +A very efficient search and replace tool using the external [ripgrep command](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md) line tool. |
| 4 | + |
| 5 | +++spc++ ++"s"++ is the search and replace menu |
| 6 | + |
| 7 | +++"g"++ ++"?"++ for help menu in the Grug-far buffer |
| 8 | + |
| 9 | + |
| 10 | +!!! NOTE "Search and replace with Grug-Far" |
| 11 | + |
| 12 | + ++spc++ ++"s"++ ++"s"++ to search across the current workspace (project) |
| 13 | + |
| 14 | + Enter a Search pattern, press ++esc++ and all occurrences across the project are shown |
| 15 | + |
| 16 | + Enter a Replace pattern, press ++esc++ to see occurrences with their replacement |
| 17 | + |
| 18 | + ++comma++ ++"r"++ to replace all occurrences with the replace pattern |
| 19 | + |
| 20 | + ++comma++ ++"j"++ / ++"k"++ replace at current line & move to next / previous change |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +??? TIP "Search results in Quicklist" |
| 25 | + ++comma++ ++"q"++ adds search results to quickfix list to edit occurrences with other Neovim tools |
| 26 | + |
| 27 | + |
| 28 | +## Search buffer |
| 29 | + |
| 30 | +Enter patterns in the **Search** and **Replace** and the results are show in a diff below. |
| 31 | + |
| 32 | +++tab++ and ++shift++ ++tab++ navigate between search buffer sections. |
| 33 | + |
| 34 | +{loading=lazy} |
| 35 | + |
| 36 | +??? EXAMPLE "Usefull Ripgrep options for Grug-Far" |
| 37 | + - `-i/--ignore-case`: ignore case differences, e.g. `rg -i fast` matches `fast`, `fASt`, `FAST`, etc. |
| 38 | + - `-F/--fixed-strings`: Disable regular expression matching and treat the pattern as a literal string. |
| 39 | + - `-w/--word-regexp`: pattern matches are surrounded by word boundaries, e.g. `pattern` is `\b(?:pattern)\b`. |
| 40 | + - `-c/--count`: a count of total matched lines. |
| 41 | + - `-a/--text`: Search binary files as if they were plain text. |
| 42 | + - `-U/--multiline`: Permit matches to span multiple lines. |
| 43 | + - `-z/--search-zip`: Search compressed files (gzip, bzip2, lzma, xz, lz4, brotli, zstd). This is disabled by default. |
| 44 | + - `-C/--context`: Show the lines surrounding a match. |
| 45 | + - `-L/--follow`: Follow symbolic links while recursively searching. |
| 46 | + - `-M/--max-columns`: Limit the length of lines printed by ripgrep. |
| 47 | + |
| 48 | + [All Ripgrep Options](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#common-options) |
0 commit comments