Skip to content

fish_user_key_bindings in fish_vi_mode #2254

Closed

Description

@martinklepsch

I was trying to map kj to ESC.

Only thing I could come up with that worked was something like this:

fish_vi_mode
function my_vi_bindings
  fish_vi_key_bindings
  bind -M insert -m default kj backward-char force-repaint
end
set -g fish_key_bindings my_vi_bindings

Previously I tried defining fish_user_key_bindings but that didn't have any effect:

-> cat ~/.config/fish/functions/fish_user_key_bindings.fish
function fish_user_key_bindings
    bind -M insert -m default kj backward-char force-repaint
end

It seems that maybe the fish_user_key_bindings function is not called after setting up vi key bindings? I grepped the code to figure out where that might be but didn't find any invocations that seemed relevant. Only the one in __fish_reload_key_bindings.

Activity

  1. konchalas commented on Jul 31, 2015

    @konchalas

    I had the same problem! i found these #1495 from @kballard

    We can't run fish_user_key_bindings for all modes, because every single existing usage of fish_user_key_bindings is written for default mode, and running it under vi mode will almost certainly cause unexpected bindings to be set.

  2. ridiculousfish commented on Jul 31, 2015

    @ridiculousfish
    Member

    I think we should run it in all modes. Presumably a user wants to use either vi key bindings or normal, not both. If they do want to use both they can check for $__fish_vi_mode.

  3. added this to the milestone on Jul 31, 2015
  4. faho commented on Aug 14, 2015

    @faho
    Member

    I agree - fish_user_key_bindings is, as the name implies, written by the user - if they want to have vi-mode, they'll write them so they work with vi-mode.

  5. faho commented on Aug 17, 2015

    @faho
    Member

    @kballard: What are your thoughts on this?

  6. added a commit that references this issue on Sep 8, 2015
    f7e8ad6
  7. added
    docs
    on Sep 14, 2015
  8. added
    release notes
    on Oct 26, 2015
  9. locked as resolved and limited conversation to collaborators on Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsrelease notes

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions