Wiki

by yszheda

View project onGitHub

Tip 31: Repeat the Last Ex Command

Return to the top: <<Practical Vim>>

  • .: repeat the most recent Normal mode command
  • @:: repeat the last Ex command

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h @:
  • : register always holds the most recently executed command line.
  • After running @: for the first time, we can subsequently repeat it with the @@ command.

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h quote_:

Example: iterating through items in the buffer list with :bn[ext] or :bp[revious].

  • use @: for repeating
  • use <C-o> for revering (also works for :next/:cnext/:tnext)