-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Deactivate doge if no placeholders left #51
Conversation
Check on InsertLeave if there are placeholders left, if not, deactivate doge.
If text is deleted in normal mode, this should be checked too.
I added proper documentation to the function, adjusted the function name to be more global and I did use the helpers function Any suggestions / recommendations or possible drawbacks towards my implementation I haven't thought about? |
Unfortunately this way TextChanged doesn't work, because if placeholders are deleted in normal mode that counter won't be updated (because it's updated when jumping). I tried a similar approach in my very first PR (checking the count) and I didn't like it. If you want it to work with TextChanged I don't think there are alternatives to search for the pattern in the autocommand, but it's not that there are performance issues or anything, so I don't see the problem. |
Agree, I haven't thought about that, but wasn't for of this while I implemented it. I changed the implementation by moving the update part in the |
You sure it's working now? tabbing in insert mode seems broken to me. |
I do have the same. Didn't test insert-mode last time. This has to do with the EDIT: This is only at the |
I think you should learn a thing or two from this guy. Then maybe you can tell me what was wrong with the function I wrote :). |
I reverted back to your previous commit. The reason I prefer my version is because your code is redundant while there is a helper function that should work, but the helper function is not being called at the auto-command |
Check on InsertLeave if there are placeholders left, if not, deactivate
doge.
Prelude
Thank you for helping out DoGe!
By contributing to DoGe you agree to the following statements (Replace
[ ]
with[x]
with those you agree with):Why this PR?
Before this PR, after the last placeholder was consumed, the first Tab keypress would still use doge mapping, which is undesiderable. It checks on InsertLeave, so that if the placeholder is reached, but not consumed, doge remains active.