Closed xoihiox closed 4 years ago
@xoihiox Thanks for your feedback, although I hadn't advertised this plugin since it's kinda experimental. I'll look into the particular issue you describe.
@xoihiox Can you share some examples where you observed this issue ? Based on your description it appears to be a performance issue, however I don't see it in most basic examples I have used. Are you working with a lisp maybe ?
Thanks for the speedy reply. Not programming in lisp, was just testing the plugin. For example, if I type this line "(this is a 'test
and complete 3 times at the end of the line, on the second completion (and for all closing brackets and braces), the cursor jumps to the matching pair before inputting the closing brace such as occurs when you type %
.
I failed to mention that single and double quotes complete as desired.
I am not too handy with vimscript, but I had looked through the code to see if I could find where this occurred, but nothing stood out. Please let me know if this is not typical, as it seems it might be due to another plugin, in which case sorry to bother you!
Thanks.
@xoihiox Yea it may be something else conflicting with what I am doing, because I am unable to reproduce it. I will however still look into it to make sure I use vim native api to avoid plugin overrides from affecting this plugin.
In that case, sorry to bring it up. It must be my rainbow-colored braces plugin. Thanks for narrowing it down for me, though.
By the way, I am currently experimenting with completion characters. Currently I am completing with the semicolon key, so completions only require a single keypress. It works pretty well, though semi-colon insertion is still a bit awkward (current mapping below).
imap ; <Plug>(pairify-complete)
inoremap : ;
inoremap :: :
To get to my point, I'll just share a couple of thoughts before closing out this issue:
"he called me a \"loser\""
. I suppose this is where things get just a bit complicated because current behavior is not so bad here: "he called me a \'loser\'"
. I think I maybe like the logic of manually completing all escaped punctuation, though, for two reasons. First, since I am manually escaping it, I am already thinking about it enough to type it correctly myself. Second, if I want to put punctuation somewhere where I know it will break the parser, I know I can do so without breaking the parser simply by escaping it.2
above and either escape here: "He called Jonas\' name"
or just manually type out the punctuation if escaped characters are unacceptable. Because the plugin only works on a single line at a time, it is difficult to get into too much trouble, so I would say it is not necessary for a more complicated solution here, such as the ability for the user to cycle through all the RHS possibilities for punctuation occurring on the initial, unpopped stack via successive completion presses or a completion menu, or the developer to write more complicated parsing logic that will end up biting him or her in the ass.@xoihiox
That was exactly my motivation behind creating this plugin, I wanted it to not be too smart and pre decide what I want and kinda give control to me to decide if or not I want completion so it doesn't come in my way.
I am aware of this, I had planned to implement this but didn't get around to doing it. Will try to get back to this.
Thanks!
Regarding the imap with semicolon key, I like the idea. I can add support for this.
The idea would be to output back the mapping in case no matches are found (nothing to complete), otherwise it will output the matching pair.
@dhruvasagar, that'd be great! All for now, cheers.
@xoihiox The commit linked above adds support for the custom mapping.
PS : There's one edge case which you may not be aware of. If the cursor is on a matching pair that is already matched, it just shifts over it.
@xoihiox Did you get a chance to have a look at this ?
@dhruvasagar, sorry for the delay (I didn't realize you had paged me). I do have some more feedback, but unfortunately I am going to have to make you wait a bit longer (2-3 weeks). I have a looming deadline that is keeping me busy.
No worries
This little plugin is fabulous, thank you.
I simply do not understand all of those other overly complicated, difficult-to-use solutions for single-character pair completions, nor do I understand how they still manage to fail so consistently.
This is perfect for my needs, though I have one question. When the pairify function is finding pairs, do you know if it is possible to do so silently, so I don't have to watch the cursor jump around the line?
Cheers.