Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Convert snake_case to camelCase in Vim

Vim replace operation to convert snake_case to camelCase (credits @Sean C.): %s/_\([a-zA-Z]\)/\u\1/g

What's it for?

Automatically refactor a script's symbol names from snake_case to camelCase.

How to use it?

  • Press ESC to ensure you're in command mode.
  • Press :.
  • Type %s/_\([a-zA-Z]\)/\u\1/g.
  • Press ENTER.

To save the changes, type :, then wq and ENTER.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.