diff options
author | Dan Davison <dandavison7@gmail.com> | 2023-05-04 22:53:53 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2023-06-02 14:36:30 -0700 |
commit | 83ca127e9e6a1e78d28e83c7ebe11ac1a5cc5faf (patch) | |
tree | 3fc27436d1d581e201de1b1654ebf0f085dbae02 /manual | |
parent | 46e44d3ba9396cf3256de6d592dcf8f17ba141c2 (diff) |
Introduce grep-output-type option: ripgrep or classic
Diffstat (limited to 'manual')
-rw-r--r-- | manual/src/grep.md | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/manual/src/grep.md b/manual/src/grep.md index 60a61d07..a090389c 100644 --- a/manual/src/grep.md +++ b/manual/src/grep.md @@ -2,19 +2,33 @@ Delta applies syntax-highlighting and other enhancements to standard grep output such as from [ripgrep](https://github.com/BurntSushi/ripgrep/) (aka `rg`), `git grep`, grep, etc. If you don't need special features of `git grep`, then for best results pipe `rg --json` output to delta: this avoids parsing ambiguities that are inevitable with the output of `git grep` and `grep`. -To customize the colors and syntax highlighting, see `grep-match-line-style`, `grep-match-word-style`, `grep-context-line-style`, `grep-file-style`, `grep-line-number-style`. +To customize the colors and syntax highlighting, see the `grep-*` options in `delta --help`. + Note that `git grep` can display the "function context" for matches and that delta handles this output specially: see the `-p` and `-W` options of `git grep`. ```sh -rg --json handle | delta +rg --json -C 2 handle | delta ``` -<table><tr><td><img width=400px src="https://user-images.githubusercontent.com/52205/225271024-a01367f0-af1b-466a-9b9e-b1ced7f80031.png" alt="image" /></td></tr></table> +<table><tr><td> +<img width="600px" alt="image" src="https://github.com/dandavison/open-in-editor/assets/52205/d203d380-5acb-4296-aeb9-e38c73d6c27f"> +</td></tr></table> + +If you enable hyperlinks then grep hits will be formatted as [OSC8 hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) in terminal emulators that support the feature. If you're using VSCode, IntelliJ, or PyCharm, then use the dedicated URL handlers. I.e. one of the following lines: + +```gitconfig +[delta] + hyperlinks = true + hyperlinks-file-link-format = "vscode://file/{path}:{line}" + # or: hyperlinks-file-link-format = "idea://open?file={path}&line={line}" + # or: hyperlinks-file-link-format = "pycharm://open?file={path}&line={line}" +``` -If you enable hyperlinks then grep hits will be formatted as [OSC8 hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) in terminal emulators that support the feature. It is then possible to make your OS handle a click on those links by opening your editor at the correct file and line number (e.g. via <https://github.com/dandavison/open-in-editor/>). +For editors that don't have special URL handlers, it is possible to use a tool like <https://github.com/dandavison/open-in-editor/> to make your OS handle a click on those links by opening your editor at the correct file and line number, e.g. ```gitconfig [delta] hyperlinks = true hyperlinks-file-link-format = "file-line://{path}:{line}" + # Now configure your OS to handle "file-line" URLs ``` |