Skip to content

Case-aware replacement #117

@beeb

Description

@beeb

Hello and thanks for a great tool!

I would love the ability to replace text while respecting the original case. For example, if I search with the case-insensitive flag -i, and I find matches for Foo as well as foo, I would like to replace Foo with Bar and foo with bar.

Bonus (nice to have)

If it can detect camelCase and PascalCase and capitalize the replacement word correctly based on that.
For example, if I search for rgr -i mysearch and replace with SomeFunction (which must be capitalized either as camel case or pascal case to trigger this behavior), then instances of mysearch map to somefunction, while instances of mySearch map to someFunction and MySearch map to SomeFunction.
I understand some cases might be ambiguous (what to do if the search only has 1 word starting with a lowercase letter, but should be capitalized as camelCase?). The solution would be to either default to lowercase and let the user fix it, or provide a way to override the case on a per-match basis through the TUI.

Let me know if that would be something you would consider adding!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions