This package provides functions which change the case of text -- from
snake_case and back.
We recommend binding these functions to relevant keys:
(bind-key "M-C" #'caser-camelcase-dwim) (bind-key "M-S" #'caser-snakecase-dwim) (bind-key "M-D" #'caser-dashcase-dwim)
Put some camelcase, snakecase, or dashcase text into a buffer. Then call one of the functions below.
caser-camelcase-dwimchanges text to camelCase
caser-snakecase-dwimchanges text to snake_case
caser-dashcase-dwimchanges text to dash-case.
The functions Do What I Mean. Hopefully, that is.
-dwimfunctions act on the region.
-dwimfunctions act on the next word.
-dwimfunctions act on that many words forward.
Sometimes, it's easier to call a
dwim function multiple times in a row, rather than select a region first. To make this easier, this mode supports repeat-mode. Repeat-mode is a way of easily repeating related commands.
To enable it, run this line:
Then, each function is able to be repeated by pressing a single letter. Once you run caser-snakecase-dwim, it can be ran gain with
s. Similarly, caser-camelcase-dwim can be repeated with
c; caser-dashcase-dwim can be repeated with
These keys can be customized; see variables
Because this package uses standard Emacs regexp character classes and case conversion functions, it fully supports changing the case of languages that don't use only ASCII letters. Try
orð á íslensku (Icelandic), or
Deutsch ist ähnlich (German).
Although languages with no capitalization can't be camelCased, they can still be changed from dash-case to snake_case: try
This is not the first casing-related Emacs package. However, it works slightly differently than these existing packages.
CI is set up at builds.sr.ht. Hopefully everything is passing.