Questions tagged [repeated-commands]

Questions about replaying the same command. This includes the dot command (.), @ macros,  @:  and similar methods.

Questions about replaying the same command. This includes the dot command .@ macros,  @:  and similar methods.

Related:

108 questions
19
votes
6 answers

Can I repeat the last UI command?

I know that I can use . to repeat the last editing command. Is there a way to repeat the last UI manipulation command? For example, I can write 10- to shrink a window by ten rows. It'd be nice to be able to press ⟨some key⟩ to…
wchargin
  • 2,717
  • 14
  • 24
10
votes
3 answers

Repeat motion easily

Sometimes I'll guess a count for a cursor movement, say 4b but it was actually 7 words away. If I'd performed an edit I could press . to repeat; I could have done @: to repeat a command line. It would be useful to repeat 4b again. This…
user859
9
votes
1 answer

Is there a way to repeat the pænultimate (or older) change?

The . command is super useful for quickly doing the last primitive action again. However, any other modification I do in between will override this. Is there a way to recall&repeat older changes without having to define them as a macro, similar to…
leftaroundabout
  • 273
  • 1
  • 4
8
votes
1 answer

Delete multiple lines by address

I was looking at this vimgolf challenge, and I thought it would be nice to delete specific lines by address. I know I can do this with :d, but is there a way to list multiple line numbers for d to be run on? I imagine something like…
Sauce McBoss
  • 745
  • 6
  • 13
6
votes
2 answers

Should the output of the -w {scriptout} flag work to replay actions using the -s {scriptin} flag?

According to the :help startup-options, this is -w's behviour -w {scriptout} All the characters that you type are recorded in the file "scriptout", until you exit Vim. This is useful if you want to create a script…
dankilman
  • 163
  • 5
5
votes
3 answers

How can I add a prefix to a few lines?

I find it sometimes useful to add a certain string to the beginning of a line, and sometimes I would like to do this to a few lines, and I don't like moving to each line and change it. Assuming I know how to select the lines that interest me in…
elyashiv
  • 2,429
  • 2
  • 18
  • 23
5
votes
4 answers

repeat insert at beginning of line

When I repeatedly inserting at the beginning of a line it is problematic because the cursor ends up in the middle of the line so I have to move back to the beginning of the line each time. So, for example, if I am commenting lines then might do…
Tyler Durden
  • 2,091
  • 2
  • 23
  • 42
4
votes
0 answers

Vim: is there a way to persist the last edit?

When you make a change, like ifooESC to insert the text foo, this can, of course, be repeated using .. However, if you quit Vim, in spite of Vim saving all sorts of state, including the contents of registers and per-file editing position and the :…
Kaz
  • 481
  • 2
  • 12
4
votes
1 answer

How do I run a shell command periodically and silently from within Vi?

Before I came here, I went to executing command from within Vim and learned it can be done using: :!command Then I went to executing it silently and figured how that I need to run: :silent exec "!command" Now I want to do it periodically like…
MaNyYaCk
  • 175
  • 1
  • 7
3
votes
1 answer

Repeat not only last command

The repeat command . is awesome. Is it possible to cycle through the last few commands, instead of only being able to repeat the last command? Something like yankring for repeat?
pfnuesel
  • 724
  • 7
  • 16
3
votes
0 answers

How to repeat last mapping/action?

I know that I can repeat last change with ., last command with @: and last motion with repmo plugin. What about other actions such as switching to the previous/next tab (gT/gt)? Is there a command for that?
Jan Warchoł
  • 253
  • 2
  • 6
3
votes
2 answers

Down and . X times?

Say I perform a combination of keys and now they are registered in . Now I want to go down X lines and run . on each one. For example say I have: {colorComponentId: 0, value: (value.warmWhite * 255)}, {colorComponentId: 1, value: (value.coldWhite *…
Philip Kirkbride
  • 993
  • 2
  • 11
  • 18
2
votes
2 answers

Change some words into _

I often do ver_w some times to change words into blanks. I am making quiz this way. What I noticed is that this is a bit of a pain. The amount of work is not so heavy as to make it a macro, but cannot be repeated by the . command. Do you come up…
Taro
  • 153
  • 3
1
vote
1 answer

Call Lua functions from repmo-vim

Repmo lets me repeat a motion, eg after typing 3j I can press ; to move another 3 lines down, or press , to move 3 lines up. I can map a new key with its forward and backward counterparts like so: nmap f repmo#Key('(QuickScopef)',…
Tom Hale
  • 2,681
  • 14
  • 32
1
vote
1 answer

How to repeat an insert at the end of a line?

I'm quite used to the very basic action of inserting some text, entering normal mode, moving to somewhere else I'd like the same text, and hitting . to do so. This doesn't work if the insert needs to be right at the end of a line though, as in…
Codemonkey
  • 411
  • 4
  • 10
1
2