Skip to content

Instantly share code, notes, and snippets.

@R3V1Z3
Last active August 20, 2018 17:10
Show Gist options
  • Save R3V1Z3/d579a8e96bac4d25a95af1f4236c75b0 to your computer and use it in GitHub Desktop.
Save R3V1Z3/d579a8e96bac4d25a95af1f4236c75b0 to your computer and use it in GitHub Desktop.

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.

Credits: https://superuser.com/questions/312073/use-notepad-to-change-under-score-case-to-camelcase#answer-312084

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment