diff --git a/cli/src/config.rs b/cli/src/config.rs index 453d7dabed..e574df9b89 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -324,7 +324,28 @@ fn env_base() -> config::Config { builder = builder.set_override("ui.color", "never").unwrap(); } if let Ok(value) = env::var("PAGER") { - builder = builder.set_override("ui.pager", value).unwrap(); + builder = builder + .set_override( + "ui.pager.command", + config::Value::new( + None, + config::ValueKind::Array(vec![config::Value::new( + None, + config::ValueKind::String(value), + )]), + ), + ) + .unwrap(); + } + // Override $LESS and $LESSCHARSET in `ui.pager.env` if they're set in the + // environment + if let Ok(value) = env::var("LESS") { + builder = builder.set_override("ui.pager.env.LESS", value).unwrap(); + } + if let Ok(value) = env::var("LESSCHARSET") { + builder = builder + .set_override("ui.pager.env.LESSCHARSET", value) + .unwrap(); } if let Ok(value) = env::var("VISUAL") { builder = builder.set_override("ui.editor", value).unwrap(); diff --git a/cli/src/config/misc.toml b/cli/src/config/misc.toml index dc279216ac..480d19e5c0 100644 --- a/cli/src/config/misc.toml +++ b/cli/src/config/misc.toml @@ -13,7 +13,7 @@ allow-filesets = false always-allow-large-revsets = false diff-instructions = true paginate = "auto" -pager = { command = ["less", "-FRX"], env = { LESSCHARSET = "utf-8" } } +pager = { command = ["less"], env = { LESS = "-FRX", LESSCHARSET = "utf-8" } } log-word-wrap = false log-synthetic-elided-nodes = true