aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/config/bindings.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-12-20 04:27:08 +0000
committerGitHub <noreply@github.com>2020-12-20 04:27:08 +0000
commitf016a209b4ac1bfa6625b9d30e6f69bc91bc7545 (patch)
treef3808e085b53f84203c322bdd408746a8c9dde1d /alacritty/src/config/bindings.rs
parent8a7f8c9d3eca214578439da417d37395971a711d (diff)
downloadr-alacritty-f016a209b4ac1bfa6625b9d30e6f69bc91bc7545.tar.gz
r-alacritty-f016a209b4ac1bfa6625b9d30e6f69bc91bc7545.tar.bz2
r-alacritty-f016a209b4ac1bfa6625b9d30e6f69bc91bc7545.zip
Add search history support
This adds a history to the regex search limited to at most 255 entries. Whenever a search is either confirmed or cancelled, the last regex is entered into the history and can be accessed when a new search is started. This should help users recover complicated search regexes after accidentally discarding them, or handle repeated searches with the same regexes. Fixes #4095.
Diffstat (limited to 'alacritty/src/config/bindings.rs')
-rw-r--r--alacritty/src/config/bindings.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
index 1dac8cdd..80900733 100644
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -264,6 +264,10 @@ pub enum SearchAction {
SearchClear,
/// Delete the last word in the search regex.
SearchDeleteWord,
+ /// Go to the previous regex in the search history.
+ SearchHistoryPrevious,
+ /// Go to the next regex in the search history.
+ SearchHistoryNext,
}
macro_rules! bindings {
@@ -503,6 +507,10 @@ pub fn default_key_bindings() -> Vec<KeyBinding> {
Escape, +BindingMode::SEARCH; SearchAction::SearchCancel;
U, ModifiersState::CTRL, +BindingMode::SEARCH; SearchAction::SearchClear;
W, ModifiersState::CTRL, +BindingMode::SEARCH; SearchAction::SearchDeleteWord;
+ P, ModifiersState::CTRL, +BindingMode::SEARCH; SearchAction::SearchHistoryPrevious;
+ N, ModifiersState::CTRL, +BindingMode::SEARCH; SearchAction::SearchHistoryNext;
+ Up, +BindingMode::SEARCH; SearchAction::SearchHistoryPrevious;
+ Down, +BindingMode::SEARCH; SearchAction::SearchHistoryNext;
Return, +BindingMode::SEARCH, ~BindingMode::VI;
SearchAction::SearchFocusNext;
Return, ModifiersState::SHIFT, +BindingMode::SEARCH, ~BindingMode::VI;