Let\'s say that I\'m in visual mode, and I type \"aw\" to extend the visual area to include the next word. I\'d like to then include the next couple of words. Is there a singl
Well there is a command to repeat every motion made with f,t,F or T
Remember that
fx takes to the next occurrence of the character x
Fx takes to the previous ocurrence of x
tx takes you to the character before the next occurrence of x
Tx takes you you to the character after the previous occurrence of x
to repeat those motions press
;
to repeat them backwards (in the oposite direction) press
,
Instead of repeating the motion, there is a plugin for expanding regions via +
and shrinking _
: https://github.com/terryma/vim-expand-region
There are some plugins that provide this functionality:
NO PLUGINS use ;.
Here's a detailed example:
int function1(){
some code here;
...
...
return 0;
}
int function2(){
some code here;
...
...
return 0;
}
Now let's say you want to rewrite the part inside {}
for function1 and function2.
{}
ESC
or ctrl+c
), press di}
(for "delete" "inner" "{"){}
of function2;.
For visual mode, I think macros is your only option (maybe overkill for aw
)
q
+ q
(that last q
can be any letter. It's where you macro will be saved)To replay these actions (even in visual mode):
@q
(or whatever letter you saved it to)To replay the actions 99 times:
99@q
(or whatever letter you saved it to)