Vim tips memo

converting camel case <-> snake case

  • crc to Camel case (eg. userName)
  • crs to Snake case (eg. user_name)
  • crm to Mixed case (eg. UserName)

Record and replay

  • Start recording with q.
  • Then type any key to register the recording. If you type a, it stores into @a.
  • Do whatever you want to record.
  • Stop recording with q.
  • Replay with the registered name which you typed. (eg. @a)
  • If you want to repeat many times, you can repeat like 10@a.

Open file under cursor in a new window

  • <c-w>f to open in a new window (Ctrl-w f)
  • gf to open in the same window (“goto file”)

Jump and back

  • c-o to jump back to older jumps.
  • c-i to come back.
  • :ju to print the jump list.