machakann / vim-sandwich

Set of operators and textobjects to search/select/edit sandwiched texts.
1.44k stars 37 forks source link

Document how to create compound recipes #145

Closed BertrandSim closed 2 years ago

BertrandSim commented 2 years ago

Hello, I've written a tutorial on how to creates compound recipes. The tutorial uses two examples, a recipe for brackets (),[],{} and a recipe for quotes '',"".

By "compound recipe", I mean a recipe made up of multiple (simple) recipes. (Eg, brackets compound recipe is made up of (), [], and {}.)

This functionality is already mentioned in the documentation. In particular, a compound recipe can be made with textobj#sandwich#auto() and an 'external' requisite. However, it may not be obvious how to do it. This probably explains why there are issues such as #103 and #139.

It is my hope that this tutorial can help others create their own custom compound recipes :)


I would like your opinion on some things:

machakann commented 2 years ago

Thanks. I'm so sorry for my late response. I will merge these commits.

I will do them.

machakann commented 2 years ago

This use case should be legal and indeed is used for tex filetype. However, I'm thinking somehow lengthy. Recently, I was thinking of an option to make this easier. That's the reason why I was so late. Excuse me.

Finally, I found that I need more and more time, and your document is nice. So I decided to merge. Thanks!

BertrandSim commented 2 years ago

Thanks for merging. Apologies for my late response, as I just saw your comments.

'synchro' option is no longer needed. It had been required some time ago but not for now. It has been deprecated.

That is good to know, thanks!

...and indeed is used for tex filetype

Yes, actually, I got the inspiration from the tex recipes that you made :D Indeed, the current method of using an external text object is rather obscure. Is this what you mean by 'lengthy'? If you do have a better way, that will be great :)

Thanks for writing this plugin. The code is nicely written.

machakann commented 2 years ago

Yes, I mentioned 'lengthy' because the functionality is rather simple but one requires to write a bunch of codes to achieve it. It would be nice if I could make it easier. I'm thinking of it these days.

Thank you for your commitment!