Skip to content

More sophisticated replace #1920

@ghost

Description

Micro's replace feature is less powerful than Nano's in a few ways:

  • Since it's just a command for the command bar and not a menu (like Find is), arguments sometimes require shell-like escaping.

  • The decision between replace and replaceall must be made at the start of the operation. Contrast Nano's approach which allows you to say "yes, and do all the ones after this" at any replace prompt. In Micro I would have to cancel and do a replaceall. And even that doesn't allow "replace all of the matches after this one" without catching the ones before.

  • There is no "find/replace backward". In Nano you could set it to go in reverse order. There are also not switches for case sensitivity or for disabling regex - they seem to be always interpeted as regexes.

  • Finally, in Nano I can switch between Find and Replace, or between literal and regex, or between case sensitive and not, or between forward and backward, with context-specific hotkeys at the find/replace menu. In Micro, these switches are all implemented as separate commands where they exist.

    I understand the rationale for having them be separate commands, it makes them more accessible to programmatic use from plugins and such (I guess). But I am missing the power of Nano's replace.

Considering diving into Micro's codebase for the first time to do something other than syntax highlighting, but first I want to know that a PR implementing these enhancements would be accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions