How do you record a macro to convert camelCase to snake_case?
Answer
qa/[A-Z]\ni_<Esc>l~q
Explanation
Record a macro that finds the next uppercase letter, inserts an underscore before it, and lowercases it. Converts camelCase identifiers.
qa/[A-Z]\ni_<Esc>l~q
Record a macro that finds the next uppercase letter, inserts an underscore before it, and lowercases it. Converts camelCase identifiers.