From 6eb6668c3ccb1f8a5921d938bd41722b11c82a7e Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Tue, 25 May 2021 16:51:07 +0100 Subject: [PATCH] config: bind ctrl+c to "cancel" in search/url mode by default Closes #544 --- CHANGELOG.md | 1 + config.c | 2 ++ doc/foot.1.scd | 2 +- doc/foot.ini.5.scd | 5 +++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5e4bbf4..04057f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ * XDG activation support, will be used by `[bell].urgent` when available (falling back to coloring the window margins red when unavailable) (https://codeberg.org/dnkl/foot/issues/487). +* `ctrl`+`c` as a default key binding; to cancel search/url mode. ### Changed diff --git a/config.c b/config.c index d0b36129..c28cfcb8 100644 --- a/config.c +++ b/config.c @@ -2333,6 +2333,7 @@ add_default_search_bindings(struct config *conf) const struct config_key_modifiers shift = {.shift = true}; const struct config_key_modifiers ctrl_shift = {.ctrl = true, .shift = true}; + add_binding(BIND_ACTION_SEARCH_CANCEL, ctrl, XKB_KEY_c); add_binding(BIND_ACTION_SEARCH_CANCEL, ctrl, XKB_KEY_g); add_binding(BIND_ACTION_SEARCH_CANCEL, none, XKB_KEY_Escape); add_binding(BIND_ACTION_SEARCH_COMMIT, none, XKB_KEY_Return); @@ -2374,6 +2375,7 @@ add_default_url_bindings(struct config *conf) const struct config_key_modifiers none = {0}; const struct config_key_modifiers ctrl = {.ctrl = true}; + add_binding(BIND_ACTION_URL_CANCEL, ctrl, XKB_KEY_c); add_binding(BIND_ACTION_URL_CANCEL, ctrl, XKB_KEY_g); add_binding(BIND_ACTION_URL_CANCEL, ctrl, XKB_KEY_d); add_binding(BIND_ACTION_URL_CANCEL, none, XKB_KEY_Escape); diff --git a/doc/foot.1.scd b/doc/foot.1.scd index 2ff4e45a..8537ee5f 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -204,7 +204,7 @@ Note that these are just the defaults; they can be changed in *shift*+*insert* Paste from primary selection into the search buffer. -*escape*, *ctrl*+*g* +*escape*, *ctrl*+*g*, *ctrl*+*c* Cancel the search *return* diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 8ee3b581..a3d6111b 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -611,7 +611,8 @@ scrollback search mode. The syntax is exactly the same as the regular *cancel* Aborts the search. The viewport is restored and the _primary - selection_ is **not** updated. Default: _Control+g Escape_. + selection_ is **not** updated. Default: _Control+g Control+c + Escape_. *commit* Exit search mode and copy current selection into the _primary @@ -688,7 +689,7 @@ mode. The syntax is exactly the same as the regular **key-bindings**. *cancel* Exits URL mode without opening an URL. Default: _Control+g - Control+d Escape_. + Control+c Control+d Escape_. *toggle-url-visible* By default, the jump label only shows the key sequence required to