zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
30.43k stars 1.85k forks source link

Powershell like "PredictionViewStyle ListView" #652

Open francogp opened 2 years ago

francogp commented 2 years ago

On powershell, you can use PSReadLine with options Set-PSReadLineOption -PredictionSource History -PredictionViewStyle ListView and you can ALWAYS show 10 rows of matching history while writing (no shortcut needed). I use it for a while, and is much useful that showing only 1 suggestion like this plugin default. Is there a way to set 5 or 6 matches in a list, always, without any shortcut, like powershell feature?

Example using powershell (NOTE that I'm only writing, not using any shortcut to start/run the list) RqjJyjWAsF

francogp commented 2 years ago

I added a video showing an example

jahedev commented 1 year ago

Would be a great feature!

YgorPerez commented 1 year ago

can we run it with a shortcut currently? I would love this feature!

bushnerd commented 1 year ago

can we run it with a shortcut currently? I would love this feature!

Yes, you can try fzf with ctrl+r.

DavidZhang73 commented 6 months ago

I came across a better solution: zsh-autocomplete.

History menu

Press to open a menu with the last 16 history items. If the command line is not empty, then the contents of the command line are used to perform a fuzzy history search.

history menu

Fuzzy multi-line history search

Press CtrlR to do a real-time history search listing multiple results.

history-search

francogp commented 2 weeks ago

I came across a better solution: zsh-autocomplete.

History menu

Press ↑ to open a menu with the last 16 history items. If the command line is not empty, then the contents of the command line are used to perform a fuzzy history search.

history menu

Fuzzy multi-line history search

Press CtrlR to do a real-time history search listing multiple results.

history-search history-search

Like I state in the OP, I'm suggesting a way without shortcuts (i'm using ctrl+R right now to achieve similar features, but it would be nice a native feature without shortcuts)

Lept14 commented 1 hour ago

Like I state in the OP, I'm suggesting a way without shortcuts (i'm using ctrl+R right now to achieve similar features, but it would be nice a native feature without shortcuts)

I have this set up on my zsh without needing to press Ctrl + R or any shortcut. It does actually still use autocomplete and fzf. The only thing I did was add zstyle ':autocomplete:*' default-context history-incremental-search-backward and zstyle ':autocomplete:history-incremental-search-backward:*' min-input 1 to my zshrc.

You can type and autocomplete will latch on like normal. After executing the command, you can repeat the process without ever having to manually pressing a shortcut.

Note: if you want to regain the ability to have suggestions for os/git/build/etc. commands, you can press Ctrl + R to "disable" the list view. Press Ctrl + R again to re-enable it.

gif