typos icon indicating copy to clipboard operation
typos copied to clipboard

Allow multi-word corrections (regex?)

Open tobiasdiez opened this issue 1 year ago • 2 comments

Sometimes the words in itself are correct, but are not used in the correct (grammatical) sense. Examples include

  • right hand side > right-hand side
  • infinite dimensional > infinite-dimensional
  • former or later > former or latter

It would be nice if such expressions could be captured as well.

Perhaps it's an idea to have a expressions group in the config (similar to words) which then matches using regular expressions. Could be used to implement project-specific rules (e.g. if a command is deprecated or a certain multi-word expression shouldn't be used).

(In the other direction, this would be https://github.com/crate-ci/typos/issues/795. It's also related to https://github.com/crate-ci/typos/issues/400.)

tobiasdiez avatar May 22 '24 08:05 tobiasdiez

Could you clarify how this is different than #795? I'm inclined to close this as a duplicate.

epage avatar Feb 19 '25 14:02 epage

My understanding of #795 is that it is about allowing spaces as the possible corrections (e.g. abouta -> about a) but not about matching strings that contain spaces as in this ticket. Moreover, I think, some of the challenges discussed in #795 don't apply to this feature request here. For example, there is less ambiguity here with what is the correct correction.

tobiasdiez avatar Feb 19 '25 16:02 tobiasdiez