VimTricks

Share this post

VimTrick: Text case coercion

vimtricks.substack.com

VimTrick: Text case coercion

Quickly convert text strings between a variety of casing conventions

Andrew Libby
May 4, 2020
3
Share this post

VimTrick: Text case coercion

vimtricks.substack.com

The Abolish plugin provides handy options to coerce strings between a variety of casing, naming, or textual conventions, each with 3 simple keystrokes. For example, an underscored string like employee_name can become EmployeeName by simply typing crm.

In the chart below, the three keystrokes indicated between the square brackets can coerce a string like SomeLongIdentifier to the result provided:

  • [crs] some_long_identifier

  • [crm] SomeLongIdentifier

  • [crc] someLongIdentifier

  • [cru] SOME_LONG_IDENTIFIER

  • [cr-] some-long-identifier

  • [cr.] some.long.identifier

  • [cr ] some long identifier

  • [crt] Some Long Identifier

All the commands start with cr and many of them can be remembered with simple mnemonics, like crc for camelCase or cr- for dasherize case.

Here’s a short demo showing conversion between various formats using several of the commands above:

Note that some coercions are one-way, in that subsequent coercions may have no way of recognizing what may have been a single word before being dasherized or having spaces inserted.


Was this useful? Help us improve!

With your feedback, we can improve VimTricks. Click a link to vote:

  • 👍Great trick, very useful. Thanks!

  • 👌I already knew this, but still helpful.

  • 👎Not interesting to me.

3
Share this post

VimTrick: Text case coercion

vimtricks.substack.com
Share
Comments
Top
New
Community

No posts

Ready for more?

© 2024 Nimble Industries, Inc.
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing

Our use of cookies

We use necessary cookies to make our site work. We also set performance and functionality cookies that help us make improvements by measuring traffic on our site. For more detailed information about the cookies we use, please see our privacy policy. ✖