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

add switch case by kind functions #4615

Closed
wants to merge 1 commit into from

Conversation

vincascm
Copy link

@vincascm vincascm commented Nov 6, 2022

No description provided.

@A-Walrus
Copy link
Contributor

A-Walrus commented Nov 6, 2022

LGTM, although you need to run cargo xtask docgen to update the auto-generated documentation to include the new commands

@vincascm
Copy link
Author

vincascm commented Nov 6, 2022

thank you for your reply. this is just a set of MappableCommand::Static, even if cargo xtask docgen executed, will not change book/src/generated/typable-cmd.md

@@ -67,6 +67,9 @@ serde = { version = "1.0", features = ["derive"] }
grep-regex = "0.1.10"
grep-searcher = "0.1.10"

# case conversion
heck = "0.4.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulls in another dependency :/

Copy link
Author

@vincascm vincascm Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heck has only one dependency : unicode-segmentation = { version = "1.2.0", optional = true }
and did not use by default

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but heck is a new dependency that's pulled in for just a couple commands.

@the-mikedavis
Copy link
Member

I don't think it's necessary to add commands for this. Converting case is possible to do with just regular editing primitives. The Kakoune introduction docs even use it to show off the power of selections and multiple cursors: https://kakoune.org/why-kakoune/why-kakoune.html#_multiple_selections

@vincascm
Copy link
Author

vincascm commented Nov 7, 2022

@the-mikedavis consider any conversion between the following 7 cases,

UpperCamelCase
lowerCamelCase
snake_case
kebab-case
SHOUTY_SNAKE_CASE
Title Case
SHOUTY-KEBAB-CASE

if regular editing primitives is used, it is not easy to do.
but these commands can indeed be composed of regular editing primitives, probably lacking a good mapping, between key bindings and a sequence of operations.

@archseer
Copy link
Member

archseer commented Nov 7, 2022

If we added macro keybinds then this would be easier to map to a key. A simpler implementation that doesn't pull in heck could also just set the macro register to a sequence of these keys, then execute the macro

@vincascm
Copy link
Author

vincascm commented Nov 7, 2022

ok, thanks for your replies

@peterwilli
Copy link

peterwilli commented Dec 18, 2023

I made my own solution after not finding anything satisfactory... Probably also helpful for #5197

See demo:
asciicast

Source is here: https://github.com/peterwilli/ToCase

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

Successfully merging this pull request may close these issues.

5 participants