Advanced VIM commands

less than 1 minute read

This only covers the commands which I deem “advanced” i.e. I shouldn’t forget but I usually do

  • ctrl-o(Insert mode): enter command mode but go right back to insert mode upon finish
  • gJ: join lines without adding space in-between
  • gu or gU + action: change to lower/upper case
  • :bd – only close current file, not the whole vi window
  • macro: record with qw  do something q; and call it with @w (w can be any register name)
  • a/i/t (all/inside/till) operation. e.g. ‘ci”‘ change everything inside double quotes (exclusive)
  • :e reload changes from disk
  • Ctrl-G : show file info
  • :r !cmd filename : run a command or from a file, read output into vi
  • m and ‘ : set and got to bookmark
  • ‘0 : go to last place when vi exited
  • z+{. - Enter}: make current line at the screen Top/Bottom/Centre
  • :set list/nolist: show line feed
  • :tabn,:tabp,:tabe {filename} : Use tab for multiple files

Categories: Tech

Updated: