zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.11k stars 1.86k forks source link

vi-mode will select auto-suggestion #689

Closed vmizener closed 1 year ago

vmizener commented 2 years ago

Describe the bug

When in vi-mode, the auto-suggestion text is selectable.

To Reproduce

Steps to reproduce the behavior:

% zsh -df
% source zsh-autosuggestions.zsh

Then typing s<ESC>A<Return> will rerun the source command.

Expected behavior

Typing s<ESC>A<Return> should run "s".

Desktop

ericfreese commented 1 year ago

A is bound to vi-add-eol in the default vicmd keybinding (vi mode). By default this plugin binds that widget to accept the suggestion if the cursor is at the end of the buffer, which it is in your example.

If you don't want that behavior, you can remove vi-add-eol from the list of widgets that accept suggestions by running something like this:

ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS:#vi-add-eol})