Skip to content

Word boundaries for Alt-B, Alt-F, Ctrl-W, Alt-Left, Alt-Right... changed with 3.4.0 update #8790

Closed

Description

@bo0ts

Since updating to fish version 3.4.0 the behaviour of Alt-B, Alt-F, and Cmd-W has changed. For example

$ asdf_adsf # pressing Cmd-W used to delete _asdf, now deletes asdf_asdf

I can't find documentation for this change and would like to be able to revert back to the old behaviour. This seems related to the discussion in issue #384

Activity

  1. faho commented on Mar 15, 2022

    @faho
    Member

    We're reasonably happy with how these things work now and won't be changing them back.

    E.g. ctrl-w is "backward-kill-path-component", it's supposed to remove one path component, and now it does.

    Sorry if that's not to your liking.

  2. added this to the will-not-implement milestone on Mar 15, 2022
  3. bo0ts commented on Mar 15, 2022

    @bo0ts
    Author

    I see why the change to Ctrl-W is sensible, but why change all other movement keys as well? This behaviour should depend on emacs or vi mode. The new behaviour is not consistent with either mode.

  4. bo0ts commented on Mar 15, 2022

    @bo0ts
    Author

    @faho Unfortunately Alt-B and Ctrl-W now have a different notion of "word":

    $ foo/bar # Ctrl-W
    $ foo/
    $ foo/bar # cursor at the end, Alt-B now jumps to beginning
    
  5. faho commented on Mar 15, 2022

    @faho
    Member

    They do, because "ctrl-w" has no notion of a "word". It has a notion of a "path-component", it acts on path components.

  6. bo0ts commented on Mar 15, 2022

    @bo0ts
    Author

    @faho A lot of thought went into the previous behaviour and it was consistent as can be seen from #384. This change throws out all the old considerations, introduces inconsistencies and in compatabilities.

    Could you at least consider making this configurable?

  7. faho commented on Mar 15, 2022

    @faho
    Member

    A lot of thought went into the previous behaviour and it was consistent

    And a lot of thought went into the current behavior, including complaints about the old being inconsistent.

    Could you at least consider making this configurable?

    We don't make things like this configurable.

    I am afraid the answer is quite simply: No. I now consider this matter closed. Sorry!

  8. krobelus commented on Mar 15, 2022

    @krobelus
    Contributor

    Since updating to fish version 3.4.0 the behaviour of Alt-B, Alt-F, and Cmd-W has changed.

    $ asdf_adsf # pressing Cmd-W used to delete _asdf, now deletes asdf_asdf

    Same thing happened on 3.3.1.

    I think the behavior you want is bind \cw backward-kill-word

    Your observed behavior change might stem from e50d104 (Remove duplicate \cw binding in default key bindings, 2015-11-08).
    That commit removed the backward-kill-word C-w binding; now only backward-kill-path-component remains.

    I don't think Alt-B or Alt-F have changed much (ever)?

    Regarding configurability: maybe it's worth adding commands like forward-regex (C-s), backward-kill-regex etc.
    They can be used to implement many possible motions.
    When used without a regex argument, they can prompt for one interactively. I think that'd be nice to navigate long commandlines. Today I just use my editor via A-e, that's good enough too.

  9. bo0ts commented on Mar 17, 2022

    @bo0ts
    Author

    @krobelus Thank you for the helpful comment. @faho Turns out this is already perfectly customisable.

    bind \eb backward-word
    bind \ef forward-word
    bind \cw backward-kill-word
    
  10. amw commented on Mar 22, 2022

    @amw

    I'm sorry, I am confused about what is the expected behavior now and I can't find any mention of this change in the release notes.

    From experience I can say I've been driven up the wall these past two days as it seems Alt stopped working for me in the most basic scenario like this:

    1. I type cd
    2. Fish suggests completion based on history like Documents/Computer/Configuration/ (displays it in muted color in front of my cursor)
    3. I press Alt+Right Arrow

    What used to happen is that it would complete the first path component and leave the other two as suggestion.

    Now it just completes the whole path – just as if I pressed Right Arrow alone without holding Alt key. I can't choose a different directory in Documents/ unless I manually type in the whole directory name.

    What am I missing? What else am I supposed to use instead of Alt+Right Arrow?

  11. krobelus commented on Mar 22, 2022

    @krobelus
    Contributor

    What used to happen is that it would complete the first path component and leave the other two as suggestion.

    Yes, that's the expected behavior.
    You have either remapped Alt+RightArrow, or your terminal sends a funny key sequence when you press that key

    Here's how you can check what key sequence is sent, and its current binding (mine is the default)

    $ fish_key_reader
    Press a key:
    bind \e\[1\;3C 'do something'
    $ bind \e\[1\;3C
    bind --preset \e\[1\;3C nextd-or-forward-word
    
  12. amw commented on Mar 22, 2022

    @amw

    I use Terminal.app on macOS and I don't believe I've changed any mapping from the default. Attached screenshot of "Keyboard" section from profile preferences.

    fish_key_reader
    Press a key:
    bind \ef 'do something'
    

    Screen Shot 2022-03-22 at 21 41 50

  13. faho commented on Mar 22, 2022

    @faho
    Member

    @amw Your terminal sends alt+f instead of alt+right. This is indistinguishable to fish.

    You want to check that "Use Option as Meta key" to unbreak it.

  14. amw commented on Mar 22, 2022

    @amw

    Unfortunately that did not help. For what it's worth I've never played with that Meta key option before and Alt+Right seemed to work. What changed in 3.4?

  15. 3 remaining items

  16. faho commented on Mar 22, 2022

    @faho
    Member

    Okay, should be fixed.

    I'm going to cherry-pick that one for 3.4.1, which should be released soon.

  17. amw commented on Mar 22, 2022

    @amw

    Setting bind --preset \ef forward-word did make Alt+Right as well as Alt+f do the right thing for me. Should I add that to my personal config or will it work out of the box after the patch?

  18. krobelus commented on Mar 22, 2022

    @krobelus
    Contributor

    nice, thanks for the report & fix. I guess our nightlies haven't been tested much with Terminal.app

    will it work out of the box after the patch?

    yes

  19. amw commented on Mar 22, 2022

    @amw

    Thank you for quick support and your work on the project!

    Me being "driven up the wall" by this for the last two days is just an indication of how important Fish has been in my life in the last 6+ years I've been using it. It's part of my brain now.

  20. zanchey commented on Mar 23, 2022

    @zanchey
    Member

    I guess our nightlies haven't been tested much with Terminal.app

    I use it but I guess I don't use Alt-F much

  21. added
    bug
    on Mar 23, 2022
  22. faho commented on Mar 23, 2022

    @faho
    Member

    Note: The original request turned out to be a misunderstanding about what the ctrl-w binding does (this was changed in 2012, not recently).

    What was fixed was a regression in alt-left/alt-right.

    So we're playing a bit fast and loose with this issue. That probably can't be helped - opening a separate issue just for that won't help much.

  23. rajashekar007 commented on May 26, 2022

    @rajashekar007

    Sorry to comment on the closed issue, but I'm encountering an issue with fish_3.4.1 on using alt-right or alt-left:
    fish: Unknown command: nextd-or-forward-word

    Any help would be appreciated. Thanks.

  24. faho commented on May 26, 2022

    @faho
    Member

    I'm encountering an issue with fish_3.4.1

    @rajashekar007
    You're not running fish 3.4.1. That's an old fish left over. Either you just need to restart fish (to get the new version), or you have an old binary lying around that's started instead of the real thing.

  25. 42xel commented on Aug 2, 2024

    @42xel

    Edit : I wasn't on 3.7.1, obviously fish --version gives the installed version, not necessarily the one running. Everything's smooth now

    @faho I have the same issue on 3.7.1. Also, I was running 3.3.1 sooner this morning which I installed not six months ago. But that's just me not reading the manual and taking whatever version was on dnf without adding any repo.

    Alt-B and Alt-F work fine, which really surprises me as I would have expected them to be binding for the same function.
    On an other machine, everything works fine. The main difference is the good one is Ubuntu, the one with an error is Oracle linux server.

    Don't bother with it though, I'll do a proper bug report after some further digging. I just had to comment that first § it was just too funny bringing up my frozen fish right after you scolded someone for months old leftovers.

  26. locked as resolved and limited conversation to collaborators on Mar 9, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions