Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #990 - Repeat last colon command

Created: September 10, 2005 5:12 Complexity: basic Author: klausenhausen Version: 5.7 Karma: 182/61 Imported from: Tip#990

The last command entered at the ':' can be repeated with @: and further repeats can be done with @@

Useful for commands like e.g. :bnext or :cNext.

Comments

I'm scrolling through the last commands with cursor up/down after pressing ':' You still can edit the command or just press ENTER.

Anonymous , September 11, 2005 23:26


This Tip becomes super useful with something like the following

%s/\<pig\>/cow/gie|:update|:next

This facilitates (as suggested by the OP) the modification of a series of files.

Note you need the 'e' of the gie g=do as many times as occurs in line i=ignore case e=don't break command if no search string found

have added this excellent tip to VimTip305


zzapper , September 12, 2005 6:05


Why not using :bufdo instead?

Anonymous , September 18, 2005 12:02


This is especially useful when doing some semi-manual repetitive search/edit task in multiple files: it becomes a matter of hitting n n . n . n n n . --AT--: n . n n . ...etc, keeping your fingers in the middle of the keyboard without having to reach for : <arrow-up> each time you need to switch files.

rix0r--AT--rix0r.nl , October 13, 2006 14:13


Advertisement