hlissner / zsh-autopair

Auto-close and delete matching delimiters in zsh
MIT License
509 stars 37 forks source link

Keys that autopair use should be able to perform their original actions after this plugin loaded #14

Open kutsan opened 6 years ago

kutsan commented 6 years ago

zsh-autopair overrides some existing keys like ", ' and such. Those keys can't be used with their original behaviour after zsh-autopair sourced if users have existing widgets for that.

Recently, owner of this plugin added two fallback for ^? (Backspace) and (Space) keys but apparently more general solution needed.

hlissner commented 6 years ago

Alright, a more generalized solution is in place. Let me know if it gives you any trouble.

kutsan commented 6 years ago

Commit a01f07411dc44fe94142fac30cf36418f8d86456 introducing a new error. It breaks the zsh-syntax-highlighting plugin and its some features are not working correctly. Everything is okay under b486f0dbdae4b420538e5fd5fe45f5f7c77316f6.

By the way, your solution isn't working even if we ignore this error. I write bindkey -M viins '^?' vi-forward-char to my .zshrc for testing purposes, before sourcing zsh-autopair. It didn't work out.

hlissner commented 6 years ago

I found the problem and pushed a fix. Let me know if it gives you trouble!

kutsan commented 6 years ago

Well, I have still the same problem. I can confirm I am on e73053db1fef731e8001062b0a739dd20caed5fb.

z0rc commented 6 years ago

I don't want to derail the plugin development, but may the features be developed in separate branches, rather then in master?

kutsan commented 6 years ago

@z0rc I agree with that.

hlissner commented 6 years ago

Agreed. Sorry, should've done that from the start. I've effectively reset master to b0a995a and moved this feature to the widget-fallback branch (which I'll put up soon).

kutsan commented 6 years ago

Also, I wouldn't force push if I were you. Now, probably someone dealing with their weird looking git history and wondering what went wrong. There is safe alternative for that.

hlissner commented 6 years ago

I apologize for any trouble, but I understand the pitfalls. Also, --force-with-lease's selling point is it prevents overwriting "unpulled" commits on the remote. It wouldn't have made a difference here.

In any case, your feature is now in widget-fallbacks, could you try it out? If it doesn't work, would you also mind trying develop too? I haven't had much luck reproducing your past issues across several computers and docker images; I'd like to be certain.

kutsan commented 6 years ago

Okay here's my report with this lines in my config.

bindkey -M viins '^?' backward-kill-word
source "$ZDOTDIR/plugins/zsh-autopair/autopair.zsh"

In develop branch, everything is like that. My binding works but there is nothing left of autopair. Backspace always deletes word backwards. Whereas it should have deleted the last pair if there is one.

In widget-fallbacks branch, everything still looks the same like I said above. It breaks zsh-syntax-highlighting and binding doesn't work at all. autopair and its other features works though.