From 0bc6a7b2edd75db411da36a5ad7436932c843b0a Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 17 Mar 2022 19:02:12 +0100 Subject: [PATCH] Make --no-config mode more comfortable (#8493) * Turn on default bindings for --no-config mode The fallback bindings are super awkward to use. This was called out specifically in #7921, I'm going for the targeted fix for now. * Only change keybindings when interactive That's also when we'd source them normally. --- src/fish.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/fish.cpp b/src/fish.cpp index e4560e63d..74b32626a 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -512,6 +512,16 @@ int main(int argc, char **argv) { if (!opts.no_exec && !opts.no_config) { read_init(parser, paths); } + + if (opts.is_interactive_session && opts.no_config && !opts.no_exec) { + // If we have no config, we default to the default key bindings. + parser.vars().set_one(L"fish_key_bindings", ENV_UNEXPORT, L"fish_default_key_bindings"); + if (function_exists(L"fish_default_key_bindings", parser)) { + std::vector cmd {"fish_default_key_bindings"}; + run_command_list(parser, &cmd, {}); + } + } + // Re-read the terminal modes after config, it might have changed them. term_copy_modes();