Introduce `general.help_hide_remaps` config entry.

pull/419/head
Tom van Dijk 3 years ago committed by Arijit Basu
parent def98de9b3
commit 263eb5943a

@ -29,6 +29,12 @@ Type: boolean
Set it to `true` if you want to enable a safety feature that will save you from
yourself when you type recklessly.
## help_hide_remaps
Type: boolean
Set it to `true` if you want to hide all remaps in the help buffer, except one.
## initial_layout
Type: string

@ -227,6 +227,9 @@ pub struct GeneralConfig {
#[serde(default)]
pub enable_recover_mode: bool,
#[serde(default)]
pub help_hide_remaps: bool,
#[serde(default)]
pub prompt: UiElement,

@ -19,6 +19,9 @@ xplr.config.general.enable_recover_mode = false
------ Start FIFO
xplr.config.general.start_fifo = nil
------ Hide remaps in help menu
xplr.config.general.help_hide_remaps = false
------ Prompt
xplr.config.general.prompt.format = " "
xplr.config.general.prompt.style.add_modifiers = nil

@ -737,10 +737,14 @@ fn draw_help_menu<B: Backend>(
.into_iter()
.map(|l| match l {
HelpMenuLine::Paragraph(p) => Row::new([Cell::from(p)].to_vec()),
HelpMenuLine::KeyMap(k, remaps, h) => Row::new(
[Cell::from(k), Cell::from(remaps.join("|")), Cell::from(h)]
.to_vec(),
),
HelpMenuLine::KeyMap(k, remaps, h) => Row::new({
if app.config.general.help_hide_remaps {
[Cell::from(k), Cell::from(h)].to_vec()
} else {
[Cell::from(k), Cell::from(remaps.join("|")), Cell::from(h)]
.to_vec()
}
}),
})
.collect::<Vec<Row>>();
@ -749,11 +753,15 @@ fn draw_help_menu<B: Backend>(
config,
format!(" Help [{}{}] ", &app.mode.name, read_only_indicator(app)),
))
.widths(&[
TuiConstraint::Percentage(20),
TuiConstraint::Percentage(20),
TuiConstraint::Percentage(60),
]);
.widths(if app.config.general.help_hide_remaps {
&[TuiConstraint::Percentage(20), TuiConstraint::Percentage(80)]
} else {
&[
TuiConstraint::Percentage(20),
TuiConstraint::Percentage(20),
TuiConstraint::Percentage(60),
]
});
f.render_widget(help_menu, layout_size);
}

Loading…
Cancel
Save