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

ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE Not Working Correctly? #322

Closed
austinarbor opened this issue Apr 23, 2018 · 10 comments
Closed

ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE Not Working Correctly? #322

austinarbor opened this issue Apr 23, 2018 · 10 comments

Comments

@austinarbor
Copy link

If I set ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE to a value < 6, for some reason it breaks the autosuggestion functionality. Anything >= 6 seems to work fine. I basically want to be able to disable autosuggestions for all pasting since whenever I paste a command it is always the full command

@ericfreese
Copy link
Member

What are you using to test that the autosuggestion functionality is broken? Can you give an example?

@austinarbor
Copy link
Author

austinarbor commented Apr 24, 2018

It appears to be working better on my personal laptop actually, when ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE >= 2. When I set it to 1, autosuggestions do not appear in the prompt when I type a command (prefix to a command). On my work laptop, for whatever reason, the autosuggestions stop appearing when I set the value to <= 5

@ericfreese
Copy link
Member

I think you may be misunderstanding how BUFFER_MAX_SIZE works. When it is set to X, no suggestions will be shown if the length of the buffer is greater than X. So when you set it to 1, no suggestions are ever shown.

for whatever reason, the autosuggestions stop appearing when I set the value to <= 5

Do autosuggestions show when you set it to 5, but type less than 3 characters? Again, a more concrete example would be very helpful here.

@austinarbor
Copy link
Author

Does buffer refer to just the clipboard buffer, or the buffer of the total input entered on the shell prompt?

@ericfreese
Copy link
Member

ericfreese commented Apr 26, 2018

It refers to the text entered into the shell prompt (http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#index-BUFFER)

If you want to disable suggestions after pasting, you could add this line to your config:

ZSH_AUTOSUGGEST_IGNORE_WIDGETS+=bracketed-paste.

@austinarbor
Copy link
Author

Oh ok, then my understanding was incorrect. I thought I had read somewhere that setting a small-ish value for ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE would improve pasting speed into the prompt (maybe here? #215 (comment) , or #141) so thats why I probably thought buffer strictly referred to the pasting buffer.

I don't necessarily care about enabling/disabling suggestions after pasting, I just want to speed up the paste action itself. What is the latest and greatest method / settings tune for that these days?

@ericfreese
Copy link
Member

Disable bracketed-paste-magic (BPM) if you don't need it. Otherwise, you can use zsh 5.4 or greater for faster pastes with BPM. Can also try the solution here, disabling autosuggestions while BPM is running. There's an example of that in the specs here: https://github.com/zsh-users/zsh-autosuggestions/blob/master/spec/integrations/bracketed_paste_magic_spec.rb

@austinarbor
Copy link
Author

I am using zsh 5.5.1 but didn't really notice any speed improvements with pasting. I commented out the lines below in ~/.oh-my-zsh/lib/misc.zsh and that did speed up pasting speed significantly!

autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic

I initially tried the first linked solution by adding those functions to my .zshrc file but that didn't seem to have any effect

Thanks for the help

@austinarbor
Copy link
Author

Just as an aside - are there any negative consequences from disabling BPM?

@ericfreese
Copy link
Member

Just as an aside - are there any negative consequences from disabling BPM?

You won't get the behavior it provides but other than that, no. I've personally not found it useful.

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

2 participants