Vim tips memo

converting camel case <-> snake case

https://stackoverflow.com/a/5186175

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

Record and replay

https://www.thegeekstuff.com/2009/01/vi-and-vim-macro-tutorial-how-to-record-and-play/

  • 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

https://vim.fandom.com/wiki/Open_file_under_cursor

  • <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.

Contents