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.
This commit is contained in:
Fabian Homborg 2022-03-17 19:02:12 +01:00 committed by GitHub
parent 7935b7327e
commit 0bc6a7b2ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<std::string> 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();