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

strange behavior when using 'setopt ignoreeof' and zsh-syntax-highlighting #377

Closed
400thecat opened this issue Oct 2, 2016 · 5 comments
Closed

Comments

@400thecat
Copy link

I have setopt ignoreeof at the beginning of my .zshrc file. Normally, when I pres ctrl+d I get following message: zsh: use 'exit' to exit. That is desired behavior.

Now when I source sh-syntax-highlighting in .zshrc, suddenly ctrl+d behaves weird. When I pres ctrl+d I get a list of all available commands, and at the bottom of the screen At Top: Hit TAB for more, or character to insert.

@danielshahaf
Copy link
Member

This is another variant of issue #245. The fix to this issue is to be merged soon, however, it requires zsh 5.3. Until then, you can try the following workaround:

ctrl-d() { zle -M "zsh: use 'exit' to exit."; return 1 } 
zle -N ctrl-d

Put that in your .zshrc before sourcing z-sy-h. (I tried just bindkey -r "^D", but that removed the use 'exit' to exit message as well.)

For future reference, the message you got is because Ctrl+d also serves as a "list completions" binding; it is bound to the delete-char-or-list widget, not to delete-char.

@danielshahaf
Copy link
Member

Sorry, that example was incomplete. It needs another line:

ctrl-d() { zle -M "zsh: use 'exit' to exit."; return 1 } 
zle -N ctrl-d
bindkey '^D' ctrl-d

@danielshahaf
Copy link
Member

Fixed on the feature/redrawhook branch.

@Diti
Copy link

Diti commented Jan 6, 2024

Under the same conditions as OP (sending EOF while using the IGNORE_EOF Zsh option), I get a list completion behavior.
zsh: do you wish to see all 3000 possibilities (800 lines)?

The aforementioned solution mentioned by @danielshahaf works; so I’ll be using it for now, but it seems silly to use instead of using setopts IGNORE_EOF.

Should I open a new issue referencing this one?

@phy1729
Copy link
Member

phy1729 commented Jan 6, 2024

I can't reproduce this. Starting from zsh -f

setopt ignoreeof
. <path to z-sy-h>
<ctrl-d>

I get the zsh: use 'exit' to exit. message. zsh 5.9 and z-sy-h 0.8.0.

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

4 participants