Skip to content

Press Backspace in history entry should accept history entry & delete last char #777

@Young-Lord

Description

@Young-Lord

What do you want?

As title, pressing Backspace when navigating through history should insert current line and delete chars from last char, just like default behavior of most shells.
Additionally, I hope that the gray semicolon at the end of the history commands is not displayed. (Related discussion: #324 #361 , but I may not need multi-select.)
demo video

Why do you want this?

For those who are just starting to use zsh-autocomplete, its behavior is consistent with the default behavior of bash, zsh, etc., thereby reducing the learning curve for users.

Who else would benefit from this?

Same as above.

How should it work?

Given the following situation:

  • Use arrow up to open history menu, navigate to any entry.

When I perform the following steps:

  1. Press Backspace.

Then I expect the following to happen:

  • I should be able to delete the last char of command, not the virtual semicolon.

Tries

I added bindkey -M menuselect -s '^?' ' ^?^?' to my .zshrc and let suf=( ) in Completions/_autocomplete__history_lines, and it almost worked as I wanted. The only issue is the space used to accept line will make cursor move right, while ^?*2 make it left, which is not smooth.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions