Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to repeat a CLI command? #1775

Closed
edasaki opened this issue May 29, 2017 · 8 comments · Fixed by #3728
Closed

Is there a way to repeat a CLI command? #1775

edasaki opened this issue May 29, 2017 · 8 comments · Fixed by #3728

Comments

@edasaki
Copy link
Contributor

edasaki commented May 29, 2017

For example, can we repeat a :s/foo/bar/g without retyping it?
I've looked around but haven't been able to find anything about this (maybe I've missed it)

@Chillee
Copy link
Member

Chillee commented May 29, 2017

#779 is a duplicate of this.

@edasaki
Copy link
Contributor Author

edasaki commented May 29, 2017

Gotcha - is there a command for this in the meantime (something we could bind to a key ourselves)? If not I may try to add it and PR

@Chillee
Copy link
Member

Chillee commented May 29, 2017

Unluckily, it's not really possible right now. VSCode doesn't allow us to modify the box that pops up for Ex commands.

It would be possible if we decided to move Ex-commands to the bottom status bar, but that doesn't seem worth it to me right now.

@edasaki
Copy link
Contributor Author

edasaki commented May 29, 2017

I mean like, what if we just made some keybind that runs the last command without any sort of interface popup?

So I type :s/foo/bar/g
Press enter to do the replace
go to some other line
press some key combination to rerun the same command again on that line

@Chillee
Copy link
Member

Chillee commented May 29, 2017

Oh, hmm. That's definitely possible. That would not be a core vim feature though.

@oschr
Copy link

oschr commented Dec 25, 2017

It actually is a core vim feature, namely typing @: in vim (in normal mode) repeats the last command (to be more precise, the last command is saved in the special : register, so you can even see it by typing :register or by pasting it into the text via ":p).

@reminia
Copy link

reminia commented Jan 5, 2018

+1

@J-Fields
Copy link
Member

J-Fields commented May 4, 2019

This should come for "free" with #2193 and #3605
Edit: actually, not quite. Vim treats @: a bit differently than other macros, but it shouldn't be too bad.

jpoon pushed a commit that referenced this issue May 6, 2019
* Implement / (search) register

Fixes #3542

* Implement read-only registers

Fixes #3604

* Implement % (file name) register

Refs #3605

* Implement : (command) register

Fixes #3605

* Do not display _ (black hole) register in :reg output

Fixes #3606

* :reg can take multiple arguments

When it does, it lists only the registers given as an argument.
Fixes #3610

* Allow the : (command) register to be used as a macro to repeat the command

Fixes #1775
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants