8000 the documented solution for hybrid key bindings does not work · Issue #3556 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

the documented solution for hybrid key bindings does not work #3556

@krader1961

Description

@krader1961

Per the discussion in issue #3068 the emacs specific bindings are no longer automatically included in the vi mode bindings. Recognizing that some people would still want to be able to create a hybrid of the default (aka emacs) and vi bindings we documented how to do so:

function hybrid_bindings --description "Vi-style bindings that inherit emacs-style bindings in all modes"
    for mode in default insert visual
        fish_default_key_bindings -M $mode
    end
    fish_vi_key_bindings --no-erase
end
set -g fish_key_bindings hybrid_bindings

Unfortunately that won't work. The reason is that the fish_vi_key_bindings function executes

set fish_key_bindings fish_vi_key_bindings

That triggers the fish C++ code to run the function a second time without the --no-erase flag (or any arguments for that matter).

The simplest solution is to also predicate that set on whether the function was not invoked with the --no-erase flag. That fixes the problem. Albeit with the side-effect that because $fish_key_bindings is no longer fish_vi_key_bindings you won't see the vi mode indicator; e.g., [I] or [N]. However, I suspect that most users of hybrid key bindings will view that as a feature.

Metadata

Metadata

Assignees

Labels

bugSomething that's not working as intended

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0