Is there a vim macro to convert CamelCase to lowercase_with_underscores and vice versa?
Mac – vim macro to convert CamelCase to lowercase_with_underscores
macrosvim
macrosvim
Is there a vim macro to convert CamelCase to lowercase_with_underscores and vice versa?
Best Answer
Tim Pope’s
abolish.vim
can convert amongcamelCase
,MixedCase
,snake_case
, andUPPER_CASE
, as well as convert (one-way) todash-case
.Position the cursor on any of
fooBar
,FooBar
,foo_bar
, orFOO_BAR
and usecrc
to convert tofooBar
crm
to convert toFooBar
cr_
orcrs
to convert tofoo_bar
cru
to convert toFOO_BAR
cr-
to convert tofoo-bar