Wikia

Vim Tips Wiki

Repeat last colon command

Talk1
1,613pages on
this wiki
Revision as of 06:02, July 13, 2012 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Tip 990 Printable Monobook Previous Next

created 2005 · complexity basic · author klausenhausen · version 5.7


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

This is useful for commands like :bnext or :cNext.

CommentsEdit

I scroll through the previous commands with cursor up/down after pressing ':'.

You still can edit the command or just press Enter.


This Tip becomes super useful with something like the following:

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

This facilitates 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

Using

q:k<CR>

is somehow better than

:<Up><CR>

key since you don't have to move your fingers out of home rows in the keyboard.

Around Wikia's network

Random Wiki