conf/shortcuts: add shortcut for COMMAND mode
Replace hardcoded Key value with customisable shortcut "general.enter_command_mode"memfd
parent
c2550f60b6
commit
8b90c7fcb6
|
@ -441,6 +441,12 @@ exit_thread = 'i'
|
|||
.Pp
|
||||
.Em general
|
||||
.Bl -tag -width 36n
|
||||
.It Ic enter_command_mode
|
||||
Enter
|
||||
.Em COMMAND
|
||||
mode.
|
||||
.\" default value
|
||||
.Pq Ql Em \
|
||||
.It Ic next_tab
|
||||
Go to next tab.
|
||||
.\" default value
|
||||
|
|
|
@ -343,6 +343,13 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
state.register_component(xdg_notifications);
|
||||
state.register_component(Box::new(components::notifications::NotificationFilter {}));
|
||||
}
|
||||
let enter_command_mode: Key = state
|
||||
.context
|
||||
.settings
|
||||
.shortcuts
|
||||
.general
|
||||
.enter_command_mode
|
||||
.clone();
|
||||
|
||||
/* Keep track of the input mode. See UIMode for details */
|
||||
'main: loop {
|
||||
|
@ -397,7 +404,7 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
state.redraw();
|
||||
}
|
||||
},
|
||||
Key::Char(' ') => {
|
||||
_ if k == enter_command_mode => {
|
||||
state.mode = UIMode::Command;
|
||||
state.rcv_event(UIEvent::ChangeMode(UIMode::Command));
|
||||
state.redraw();
|
||||
|
|
|
@ -79,7 +79,7 @@ macro_rules! shortcut_key_values {
|
|||
#[serde(default)]
|
||||
#[serde(rename = $cname)]
|
||||
pub struct $name {
|
||||
$($fname : Key),*
|
||||
$(pub $fname : Key),*
|
||||
}
|
||||
|
||||
impl $name {
|
||||
|
@ -163,6 +163,7 @@ shortcut_key_values! { "pager",
|
|||
|
||||
shortcut_key_values! { "general",
|
||||
pub struct GeneralShortcuts {
|
||||
enter_command_mode |> "Enter COMMAND mode." |> Key::Char(' '),
|
||||
go_to_tab |> "Go to the nth tab" |> Key::Alt('n'),
|
||||
next_tab |> "Next tab." |> Key::Char('T'),
|
||||
scroll_right |> "Generic scroll right (catch-all setting)" |> Key::Right,
|
||||
|
|
Loading…
Reference in New Issue