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

Toggle quotes (ts) #98

Open
kylechui opened this issue Jul 20, 2022 · 12 comments
Open

Toggle quotes (ts) #98

kylechui opened this issue Jul 20, 2022 · 12 comments
Assignees
Labels
enhancement New feature or request

Comments

@kylechui
Copy link
Owner

kylechui commented Jul 20, 2022

On behalf of #79, add a new keymap for toggling quotes, perhaps ytq for "you toggle quotes" tsq for "toggle surrounding quotes. For example in the buffer:

local str = "This seems to be my default example"

Hitting tsq.. will toggle the double quotes "'`". The exact order can probably be determined via some config option in the setup table. Perhaps use aliases or a new section titled cycles or something. While the aliases table could be used, it makes some sense to keep it separate, so dsb could be preserved for deleting parentheses, while opening up tsb for toggling the nearest bracket: ), }, ], >. Open to suggestions from the community on how they would like the interface to look!

I could also just change it so aliases are used and p refers to any pair of those brackets, instead of "overloading" the use of b that much.

@kylechui kylechui added the enhancement New feature or request label Jul 20, 2022
@kylechui
Copy link
Owner Author

@voyeg3r Seeing as you were the one requesting the feature, perhaps you can give a bit more information/a more concrete description of what you would like to see out of this feature?

@devkvlt
Copy link

devkvlt commented Jul 21, 2022

I too would love to have this feature.

@kylechui
Copy link
Owner Author

@devkvlt Thanks for the input; it will probably be the next "big" feature I add after pattern-based modifications in #101

@kylechui kylechui changed the title Toggle quotes (yt) Toggle quotes (ts) Jul 25, 2022
@voyeg3r
Copy link

voyeg3r commented Jul 26, 2022

@voyeg3r Seeing as you were the one requesting the feature, perhaps you can give a bit more information/a more concrete description of what you would like to see out of this feature?

I think you have captured the gist of the idea, hit a key combination to quickly change double quotes to single quotes and/or crasis

@kylechui
Copy link
Owner Author

kylechui commented Jul 26, 2022

@voyeg3r Do you think it would be a bad idea to "tie" this feature together with aliases? For example, you would be able to have tsp for braces, but that would force dsp to delete all sorts of braces as well.

On second consideration it's probably a bad idea to "mix" the two features together; it's probably better to add a new key toggle into the setup table, e.g.

toggle = {
    q = { "'", '"', "`" },
}

@pearofducks
Copy link

pearofducks commented Jul 27, 2022

Just wanted to throw in that my intuitive guess at how this feature worked would have been that csqq would have done what the original message is suggesting tsq does.

csqb changes quotes to brackets, so it feels somewhat "natural" to me that csqq would change the quotes to another quote-type.

Regardless, thanks for the work done on this awesome plugin!

@kylechui
Copy link
Owner Author

kylechui commented Jul 27, 2022

@pearofducks Thanks for the kind words :) As for csqq, I think this could work as a feature but I think it would be relatively limited in scope, at least for me. The example I cited earlier was that I would like tsb to toggle between () and {}, but also dsb to delete parentheses (I'm a bit weird), which wouldn't be possible with your suggestion. Also I think that ts as a keymap prefix just makes more sense, as it follows the cs/ds scheme.

Edit: csqq would also force me to introduce a "special" case for the cs operator, since it would have to discern whether or not del_char and ins_char are the same

@pearofducks
Copy link

Totally makes sense, just throwing that out there in case it made things easier instead of harder! :)

@kylechui
Copy link
Owner Author

kylechui commented Jul 27, 2022

Yeah, the basic idea is that ysiwq doesn't exist, because q is ambiguous when it comes to which delimiter pair to add to the buffer. For that reason, cs)q or csqq wouldn't be "well-defined behavior" as well. Thanks for the suggestion though!

@voyeg3r
Copy link

voyeg3r commented Aug 3, 2022

@voyeg3r Do you think it would be a bad idea to "tie" this feature together with aliases? For example, you would be able to have tsp for braces, but that would force dsp to delete all sorts of braces as well.

On second consideration it's probably a bad idea to "mix" the two features together; it's probably better to add a new key toggle into the setup table, e.g.

toggle = {
    q = { "'", '"', "`" },
}

I think having a separated table for toggling quotes is better

@kylechui kylechui added this to the Release v1.1.0 milestone Aug 7, 2022
@kylechui kylechui self-assigned this Aug 7, 2022
@kylechui
Copy link
Owner Author

Pushing this back a bit since I made a handful of breaking changes here and there for v2.0.0, and I would like people to really test what exists first before I add any new features.

@kylechui
Copy link
Owner Author

kylechui commented Jun 7, 2024

Are people still interested in this? Sorry for pushing it back so much 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants