Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline suggestions in zsh like zsh-autosuggestions #85

Open
cantino opened this issue May 24, 2020 · 6 comments
Open

Inline suggestions in zsh like zsh-autosuggestions #85

cantino opened this issue May 24, 2020 · 6 comments

Comments

@cantino
Copy link
Owner

cantino commented May 24, 2020

What would it take to make a zsh-autosuggestions completion hook for McFly?

@cantino
Copy link
Owner Author

cantino commented May 25, 2020

Also might be able to improve bash bindings using something like https://stackoverflow.com/questions/57811962/bind-up-arrow-key-to-fzf-command

@NightMachinery
Copy link

@cantino You might even be able to reuse zsh-autosuggestions itself. They added the ability to add “providers” to the suggestions (like inline suggestions for completions), and I think you can use that abstraction to easily add your history suggestions. (I have no further knowledge, I guess you can just open an issue and ask them.)

@Mic92
Copy link
Contributor

Mic92 commented Aug 9, 2021

Does not look very complex: https://github.com/zsh-users/zsh-autosuggestions/blob/master/src/strategies/history.zsh#L31

Could mcfly search just output all suggestions as lines instead of opening a TUI when it detects a non-tty file on stdout?

@Mic92
Copy link
Contributor

Mic92 commented Aug 9, 2021

The hacky work around is using this:

╭─[~/.homesick/repos/dotfiles/zsh/zsh-autosuggestions]─[tags/v0.6.4]
╰─ % mcfly search --output-selection /tmp/foo1 foo </dev/null

╭─[~/.homesick/repos/dotfiles/zsh/zsh-autosuggestions]─[tags/v0.6.4]
╰─ % cat /tmp/foo1
mode display
commandline foo

however it still tries to spawn a menu for a split-second.

@praveenperera
Copy link
Collaborator

@cantino do you mean like what this does? https://github.com/Aloxaf/fzf-tab

@Mic92
Copy link
Contributor

Mic92 commented Aug 9, 2021

Not quite, Auto-suggestions show up without tabs.

This hacky line extracts suggestions:

$ suggestion=$(script -q -O /dev/null -c "mcfly search -o /proc/self/fd/3 test </dev/null" 3>&1 >/dev/null)
$ echo $suggestion
mode display
commandline test
$ filtered=$(echo $suggestion | grep -oP '(?<=commandline )\w+')
$ echo $filtered
test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants