Repeating Commands

Top  Previous  Next

All of the commands available in Command Mode can be preceded by a number. The number causes the command to be executed that many times. For example, “5D” deletes five characters back from the cursor. If there is no number, or if it is zero, the effect is the same as 1.

 

Sometimes you want to execute a command over and over until the command fails. For example, you might want to search for and replace some string throughout the edit buffer. You can use a very large number, but the symbol ”#” indicates that a command is to be executed repeatedly until it fails. For example, to find the final occurrence of the word “frog” type:

 

               <Esc>#Sfrog<Esc><Esc>