From 4b516c63654465041604d3e4c816136a902287a4 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sun, 9 Aug 2020 22:57:55 +0000 Subject: [PATCH] Add ^C binding to cancel search and leave Vi mode Fixes #4089. --- CHANGELOG.md | 1 + alacritty.yml | 1 + alacritty/src/config/bindings.rs | 1 + alacritty/src/input.rs | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3255e2e..0d792622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Secondary device attributes escape (`CSI > 0 c`) - Support for colon separated SGR 38/48 +- New Ctrl+C binding to cancel search and leave vi mode ### Changed diff --git a/alacritty.yml b/alacritty.yml index da41059a..e1665e66 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -637,6 +637,7 @@ #- { key: Escape, mode: Vi, action: ClearSelection } #- { key: I, mode: Vi, action: ScrollToBottom } #- { key: I, mode: Vi, action: ToggleViMode } + #- { key: C, mods: Control, mode: Vi, action: ToggleViMode } #- { key: Y, mods: Control, mode: Vi, action: ScrollLineUp } #- { key: E, mods: Control, mode: Vi, action: ScrollLineDown } #- { key: G, mode: Vi, action: ScrollToTop } diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs index 1c07a33b..74514a5a 100644 --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -368,6 +368,7 @@ pub fn default_key_bindings() -> Vec { Escape, +TermMode::VI; Action::ClearSelection; I, +TermMode::VI; Action::ScrollToBottom; I, +TermMode::VI; Action::ToggleViMode; + C, ModifiersState::CTRL, +TermMode::VI; Action::ToggleViMode; Y, ModifiersState::CTRL, +TermMode::VI; Action::ScrollLineUp; E, ModifiersState::CTRL, +TermMode::VI; Action::ScrollLineDown; G, +TermMode::VI; Action::ScrollToTop; diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index b6aca62b..44d81217 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -832,7 +832,8 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { *self.ctx.suppress_chars() = true; }, - (Some(VirtualKeyCode::Escape), _) => { + (Some(VirtualKeyCode::Escape), _) + | (Some(VirtualKeyCode::C), ModifiersState::CTRL) => { self.ctx.cancel_search(); *self.ctx.suppress_chars() = true; },