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

expansion doesn't trigger syntax highlighting #158

Open
DanielFGray opened this issue May 14, 2016 · 7 comments
Open

expansion doesn't trigger syntax highlighting #158

DanielFGray opened this issue May 14, 2016 · 7 comments

Comments

@DanielFGray
Copy link

I use zsh-syntax-highlighting, and expanding a suggestion seems to 'break' syntax highlighting until another key is pressed.

@ericfreese
Copy link
Member

This is not expected behavior. Can you give some details about your setup (OS, zsh version, plugin version)? It would also be helpful if you could provide minimum steps to reproduce the problem.

For example, I'm not seeing the issue with Mac OS X, zsh 5.2, z-asug v0.3.1, z-sy-h v0.4.1, and the following:

% zsh -f
%% source zsh-syntax-highlighting.zsh; source zsh-autosuggestions.zsh
%% echo hello
%% echo <expand suggestion>

@DanielFGray
Copy link
Author

DanielFGray commented May 28, 2016

I'm using Ubuntu 16.04 and zsh 5.1.1 with oh-my-zsh. I also have another machine running Arch and zsh 5.2 + omz that does the same thing, both plugins are git pulled daily via cron on all machines.

In my zshrc with omz, I use plugins=( vi-mode zsh-syntax-highlighting zsh-autosuggestions ) swapping the order of those two doesn't make a difference.

Even without omz, and manually sourcing as per your example above, expanding doesn't trigger syntax highlighting of the expanded text..

@nifr
Copy link

nifr commented Sep 21, 2016

Same issue here. The expanded part is not being syntax-highlighted after accepting a suggestion with <Ctrl>+<Space>.

Adding another space after expansion triggers syntax-highlighting correctly but most of the times you just want to run the suggested command as next step which leaves half of the command non-highlighted.

@eigengrau
Copy link

eigengrau commented Jan 31, 2017

FWIW, while I haven’t tried to further identify the cause so far, I was able to work around this issue by calling zle redisplay; zle redisplay; (yes, twice) after the autosuggest-accept widget runs (I achieved this by wrapping and ignoring the accept widget).

@ratheesh
Copy link

@eigengrau Can you please paste the patch for others to use the workaround ?

@eigengrau
Copy link

eigengrau commented Jan 31, 2017

I didn’t patch the sources, only wrapped the widget in my .zshrc like this:

my-autosuggest-accept() {
    zle autosuggest-accept
    zle redisplay
    zle redisplay
}

zle -N my-autosuggest-accept

ZSH_AUTOSUGGEST_IGNORE_WIDGETS+=my-autosuggest-accept

bindkey '^ ' my-autosuggest-accept

@ratheesh
Copy link

ratheesh commented Jan 31, 2017

@eigengrau Thank you. it works.

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

No branches or pull requests

5 participants