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

Can be zsh-autosuggestions suppressed for one command? #193

Closed
psprint opened this issue Sep 6, 2016 · 5 comments
Closed

Can be zsh-autosuggestions suppressed for one command? #193

psprint opened this issue Sep 6, 2016 · 5 comments

Comments

@psprint
Copy link

psprint commented Sep 6, 2016

I have a plugin that assigns to BUFFER. Text appears at command line, and zsh-autosuggestions quickly proposes a continuation. Can I suppress this? I put into BUFFER a complete command that doesn't need continuation, seeing the propositions makes it harder to read the command.

PS. Also, when I tried to follow the command assigned to BUFFER with "#" hoping that comment context will stop zsh-autosuggestion, what happened is:

cd /Users/sgniazdowski/.zplugin/plugins/zsh-users---zsh- #cd /Users/sgniazdowski/.zplugin/plugins/zsh-users---zsh-syntax-highlighting/highlighters/main

I.e. a suggestion including whole considered text appeared after "#"

It would be really great to be able to set ZSH_AUTOSUGGESTIONS_SKIP=1 and have clean command line for one entry, otherwise reading the command is a pain :|

@psprint
Copy link
Author

psprint commented Sep 13, 2016

Hello again,
I now use a small program that uses TIOCSTI to feed input to Zsh:

https://github.com/psprint/zconvey/blob/master/feeder/feeder.c#L15-L25

It works slow because of autosuggestions, and say "artifacts" of suggested text are visible during sending of command. So again, could something like ZSH_AUTOSUGGESTIONS_SKIP_ONE=1 be added?

@ericfreese
Copy link
Member

when I tried to follow the command assigned to BUFFER with "#" hoping that comment context will stop zsh-autosuggestion ... a suggestion including whole considered text appeared after "#"

This definitely shouldn't be happening. It would be helpful if you can isolate this problem. Does it happen with no other plugins loaded? What version of z-asug are you using? What version of zsh? etc.

I have a plugin that assigns to BUFFER. Text appears at command line, and zsh-autosuggestions quickly proposes a continuation. Can I suppress this?

Would it solve your problem to add the name of the plugin widget that assigns to BUFFER to the list of widgets to clear the suggestion? I think that would prevent z-asug from giving a suggestion after your widget is run.

% function my-widget() { BUFFER="hello world" }
% zle -N my-widget
% bindkey '^I' my-widget
% ZSH_AUTOSUGGEST_CLEAR_WIDGETS=($ZSH_AUTOSUGGEST_CLEAR_WIDGETS my-widget)

@ericfreese
Copy link
Member

I now use a small program that uses TIOCSTI to feed input to Zsh ... It works slow because of autosuggestions

Interesting. I wonder if this is the cause of the delay when using z-asug with Midnight Commander as reported in #136.

I'm hoping that performance issues like this will be fixed with #170.

@balta2ar
Copy link

@psprint
Copy link
Author

psprint commented Sep 25, 2017

After working with Zshelldoc and using zsh-autosuggestions.zsh as a test file, I started to understand your code. I now would be able to investigate, however:

  • The autosuggestions' switch to asynchronous (via zpty) fetching solved all problems.

So the issue can be closed, I think. Or maybe it would be useful to mute zsh-autosuggestions till next precmd hook.

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

3 participants