Skip to content

Simultaneously edit multiple text ranges with related meanings, but different forms. (Atom package)

License

Notifications You must be signed in to change notification settings

halohalospecial/atom-polymorph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymorph

Simultaneously edit multiple text ranges with related meanings, but different forms.

Screenshots

Easier to explain with screenshots! :)

case1

case2

redux

cardinality

verb-form

color

inverse

xml

Commands

Polymorph: Mark Next In Any Case And Form

Marks the next text range which has a related meaning with the active selection, but has a different letter case or form. If nothing is selected, this will select the longest "superword" under the cursor. Invoke this multiple times to mark the next matching text ranges, similar to Find And Replace: Select Next. Editing the source text range will also edit the marked ranges. Press escape when you're done.

Polymorph: Skip Last Marked

Unmarks the last marked text range. Invoking Polymorph: Mark Next In Any Case And Form again will mark the next matching text range, skipping the unmarked one. This command is useful if Polymorph marked an incorrect text range.

skip

Polymorph: Select All Marked

Selects all marked text ranges.

select-marked

Polymorph: Case Preserving Paste

Use this instead of Core: Paste to coerce the case of the pasted text into the case of the target selection. For example, if the copied text is "mark-next-in-any" and the target selection is "casePreservingPaste", the pasted text will become "markNextInAny" because the target is in camel case.

paste

Forced Transformation Commands

These commands work on selections and ranges marked by Polymorph.

  • Polymorph: Capitalize
  • Polymorph: Decapitalize
  • Polymorph: Snake Case
  • Polymorph: Screaming Snake Case
  • Polymorph: Kebab Case
  • Polymorph: Cobol Case
  • Polymorph: Upcase
  • Polymorph: Downcase
  • Polymorph: Camel Case
  • Polymorph: Pascal Case
  • Polymorph: Invert
  • Polymorph: Pluralize
  • Polymorph: Singularize
  • Polymorph: To Past
  • Polymorph: To Present
  • Polymorph: To Infinitive
  • Polymorph: To Gerund
  • Polymorph: To Comparative
  • Polymorph: To Superlative
  • Polymorph: To Noun
  • Polymorph: To Adverb
  • Polymorph: To Adjective
  • Polymorph: To Color Name
  • Polymorph: To Color Hex8
  • Polymorph: To Color Hex6
  • Polymorph: To Color Hex3
  • Polymorph: To Color Rgb
  • Polymorph: To Color Rgba
  • Polymorph: To Color Prgb
  • Polymorph: To Color Hsl
  • Polymorph: To Color Hsv

Example keybindings

'atom-text-editor':
  'cmd-e': 'polymorph:mark-next-in-any-case-and-form'
  'shift-cmd-e': 'polymorph:skip-last-marked'
  'ctrl-e': 'polymorph:select-all-marked'
  'shift-cmd-v': 'polymorph:case-preserving-paste'

Credits

Uses nlp_compromise and tinycolor2.

Prior Art

After some searching, the closest I could find was abolish.vim by Tim Pope. That vim plugin lets you replace text by specifying some rules (e.g. :%Subvert/facilit{y,ies}/building{,s}/g to replace all instances of "facility" with "building" and "facilities" with "buildings").

Polymorph attempts to figure out the rules instead, making it less precise, but more magical.

About

Simultaneously edit multiple text ranges with related meanings, but different forms. (Atom package)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published