Vim Tips Wiki
No edit summary
 
(Removed {{review}} tag)
Tag: Visual edit
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
{{TipImported
{{review}}
 
{{Tip
 
 
|id=990
 
|id=990
  +
|previous=989
|title=Repeat last
 
  +
|next=991
|created=September 10, 2005 5:12
+
|created=2005
 
|complexity=basic
 
|complexity=basic
 
|author=klausenhausen
 
|author=klausenhausen
 
|version=5.7
 
|version=5.7
 
|rating=182/61
 
|rating=182/61
  +
|category1=
|text=
 
  +
|category2=
The last command entered at the ':' can be repeated with @: and further repeats can be done with @@
 
 
}}
 
The last command entered with ':' can be repeated with <code>@:</code> and further repeats can be done with <code>@@</code>
   
Useful for commands like e.g. :bnext or :cNext.
+
This is useful for commands like <code>:bnext</code> or <code>:cNext</code>.
   
 
==Comments==
 
I scroll through the previous commands with cursor up/down after pressing ':'.
   
 
You still can edit the command or just press Enter.
   
 
}}
 
 
== 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
+
This Tip becomes super useful with something like the following:
   
  +
<pre>
:%s/\&lt;pig\&gt;/cow/gie|:update|:next
+
:%s/\<pig\>/cow/gie|:update|:next
  +
</pre>
   
This facilitates (as suggested by the OP) the modification of a series of files.
+
This facilitates the modification of a series of files.
   
Note you need the 'e' of the gie
+
Note you need the 'e' of the gie
g=do as many times as occurs in line
+
*g=do as many times as occurs in line
i=ignore case
+
*i=ignore case
e=don't break command if no search string found
+
*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 : &lt;arrow-up&gt; each time you need to switch files.
 
   
rix0r--AT--rix0r.nl
 
, October 13, 2006 14:13
 
 
----
 
----
  +
Using
<!-- parsed by vimtips.py in 0.668946 seconds-->
 
  +
<pre>
  +
q:k<CR>
  +
</pre>
  +
is somehow better than
  +
<pre>
  +
:<Up><CR>
  +
</pre>
  +
key since you don't have to move your fingers out of home rows in the keyboard.

Revision as of 19:42, 23 January 2015

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.

Comments

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.