Vim Tips Wiki
m (Added to Usage Category)
(Add example - can repeat inserting text.)
Line 18: Line 18:
   
 
In normal mode, press '''J''' to join the next line onto the current line. Use the "." command to join more lines.
 
In normal mode, press '''J''' to join the next line onto the current line. Use the "." command to join more lines.
  +
  +
Or, you might use insert mode to type "hello ". Press Esc for normal mode, then move the cursor, then press '''.''' to insert "hello " again.
   
 
== References ==
 
== References ==

Revision as of 01:03, 21 June 2007

Previous TipNext Tip

Tip: #44 - Repeat last change

Created: March 12, 2001 8:45 Complexity: basic Author: Anonymous Version: 5.7 Karma: 14/5 Imported from: Tip#44

The "." command repeats the last simple change made in normal mode. For example, if you press dw to delete a word, you can then press . to delete another word (. is dot, aka period or full stop).

The "@:" command repeats the last command-line change (a command invoked with ":", for example :s/foo/bar).

You can move the cursor before using either of the repeat commands.

Suppose you press dd to delete a line. Next, you might move the cursor, then press 5. ("5" then "."). That will delete 5 lines.

In normal mode, press J to join the next line onto the current line. Use the "." command to join more lines.

Or, you might use insert mode to type "hello ". Press Esc for normal mode, then move the cursor, then press . to insert "hello " again.

References

:help single-repeat

Comments