summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-11-14 14:15:51 -0500
committerDan Davison <dandavison7@gmail.com>2021-11-22 13:18:15 -0500
commit07892bc572a92bca8e3fec3d1b0ba717d80cc096 (patch)
tree8da5b5e842d95291edd2bf29b6b1b2dce345fbb1 /src/config.rs
parentce6258d1b85f9a4624a430cc2aac2a510aabb08a (diff)
Handle grep output
- Handle standard filepath:code and filepath:line_number:code output as produced by `git grep`, `rg -H`, `grep -H`, etc (with -n for line numbers). - Retain the match highlighting as produced by the grep tool, and expose it in delta's color output styled with grep-match-style. (Note that --color=always is needed to retain the color if piping into delta, but not for `git grep` when delta is configured as git's pager) - Special handling of -p, and -W options of `git grep`: these display the function context in which the matches occur. - `navigate` keybindings jump between match function contexts under `git grep -p` and between matching lines under `git grep -W`. Thanks @zachriggle for the proposal. Fixes #769
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index 71aa8382..12b82945 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -80,6 +80,12 @@ pub struct Config {
pub git_config: Option<GitConfig>,
pub git_minus_style: Style,
pub git_plus_style: Style,
+ pub grep_context_line_style: Style,
+ pub grep_file_style: Style,
+ pub grep_line_number_style: Style,
+ pub grep_match_line_style: Style,
+ pub grep_match_word_style: Style,
+ pub grep_separator_symbol: String,
pub hunk_header_file_style: Style,
pub hunk_header_line_number_style: Style,
pub hunk_header_style_include_file_path: bool,
@@ -243,6 +249,12 @@ impl From<cli::Opt> for Config {
file_style: styles["file-style"],
git_config: opt.git_config,
git_config_entries: opt.git_config_entries,
+ grep_context_line_style: styles["grep-context-line-style"],
+ grep_file_style: styles["grep-file-style"],
+ grep_line_number_style: styles["grep-line-number-style"],
+ grep_match_line_style: styles["grep-match-line-style"],
+ grep_match_word_style: styles["grep-match-word-style"],
+ grep_separator_symbol: opt.grep_separator_symbol,
hunk_header_file_style: styles["hunk-header-file-style"],
hunk_header_line_number_style: styles["hunk-header-line-number-style"],
hunk_header_style: styles["hunk-header-style"],