diff --git a/src/cli.rs b/src/cli.rs index 57eaff863..76e45e5ae 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -231,12 +231,23 @@ pub struct Opt { /// needed. pub blame_palette: Option, - #[clap(long = "blame-separator", default_value = "│", value_name = "STRING")] - /// Separator between the commit metadata and code sections of a git blame line. - pub blame_separator: String, + #[clap( + long = "blame-separator-format", + default_value = "│{n:^4}│", + value_name = "FMT" + )] + /// Separator between the blame format and the code section of a git blame line. + /// + /// Contains the line number by default. Possible values are "none" to disable line numbers or a format + /// string. This may contain one "{n:}" placeholder and will display the line number on every line. + /// A type may be added after all other format specifiers and can be separated by '_': + /// If type is set to 'block' (e.g. "{n:^4_block}") the line number will only be shown when a new blame + /// block starts; or if it is set to 'every-N' the line will be show with every block and every + /// N-th (modulo) line. + pub blame_separator_format: String, #[clap(long = "blame-separator-style", value_name = "STYLE")] - /// Style string for the separator between the commit metadata and code sections of a git blame line. + /// Style string for the blame-separator-format. pub blame_separator_style: Option, #[clap( diff --git a/src/config.rs b/src/config.rs index 77483502c..67e435b1a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,6 +17,8 @@ use crate::features::navigate; use crate::features::side_by_side::{self, ansifill, LeftRight}; use crate::git_config::{GitConfig, GitConfigEntry}; use crate::handlers; +use crate::handlers::blame::parse_blame_line_numbers; +use crate::handlers::blame::BlameLineNumbers; use crate::minusplus::MinusPlus; use crate::paint::BgFillMethod; use crate::parse_styles; @@ -64,8 +66,8 @@ pub struct Config { pub background_color_extends_to_terminal_width: bool, pub blame_code_style: Option