ease for cases
Casease can help you convert cases when you typing a name, like snake_case, camelCase, PascalCase, SCREAMING_CASE.
It can be easily setup with different rules for different programming major modes.
(require 'casease)
(casease-setup
:hook python-mode-hook
:separator ?-
:entries
((pascal "\\(-\\)[a-z]" "[A-Z]")
(snake "[a-z]")))
;;; hook will be setup, re-run after changing rules or separator
Above is an example setup for python-mode
, here we use hyphen as separator.
The entries
tells casease when to start conversion, rules will be tested with order.
Each rule is a list, the first element is the target case, the rest elements are regexps.
If the regexp is matched when looking back from the position of your cursor, conversion will start.
The regexp can have at most one capture group, the captured text will be deleted when conversion start.
The regexp should match at most two characters.
In this example, we can input “the_snake_case” with “the-snake-case”, and input “ThePascalCase” with “-the-pascal-case”.
The conversion will stop once your cursor leaving the highlight or you give a non alphanum input.
See document of casease-setup
for more advanced used.
snake
for snake_casecamel
for camelCasepascal
for PascalCasescreaming
for SCREAMING_CASEkebab
for kebab-case
Under GPLv3.