microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.57k stars 29.02k forks source link

Add a command that redos the last command that was executed #57070

Open lonix1 opened 6 years ago

lonix1 commented 6 years ago

Please add a "repeat last command" command and keybinding, as sometimes found in other other apps, e.g. Microsoft Office.

I want to press a shortcut, and for it to repeat whatever the last command was, so I don't have to find it again in the menu or the ctrl-shift-p box.

This is especially useful when doing a lot of editing.

macintacos commented 4 years ago

One thing that I don't think is super clear from the description of this issue is that what I think should be added is the ability to re-run the last command, no matter where it originated from. I wouldn't want it to just "re-run the first command that shows up in the command palette" because that won't always be the last command you ran. For example, hitting "CMD+W" to close an editor doesn't show up in the command palette as the "last command", but that's what I'd want to be the last command if this feature was implemented.

lonix1 commented 4 years ago

I'm closing this as this functionality is available - ctrl-shift-p already shows the last command, so just pressing enter performs this task.

@macintacos Please open another issue for that, it's quite different.

macintacos commented 4 years ago

@lonix1 while I will end up creating another issue for what I described, why close this one? There isn’t a command to re-do the first command that shows up when you hit “Ctrl+shift+p”, so I’d argue that this functionality is still not available in the way that you initially described. There’s no way to map a shortcut to execute the last command you ran (ignoring my requirements that I mentioned in my previous comment), is there?

lonix1 commented 4 years ago

ctrl-shit-p and enter - repeats the last command

macintacos commented 4 years ago

But that's not really a standalone command to redo the last action, that just happens to be the way the command palette works.

I had thought that this issue was covering "there should be an explicit command in VSCode to execute the last command", one that presumably you could map at will so that it can be a completely different shortcut than pressing ctrl-shift-p and then hitting "enter" (which is one more key than I'd want to be honest).

I guess I'll open another issue that asks for that, but it's just going to look like a duplicate of this one.

lonix1 commented 4 years ago

ok

jbriales commented 4 years ago

I agree with @macintacos, an explicit action with this behavior would be more convenient (to map it to a concrete shortcut at your will). Is there any expectations or ideas on this?

TheHubbit commented 4 years ago

Ctrl-shift-p + enter works if the command did not have arguments. Otherwise the argument selection needs to be repeated. Would be great to have a shortcut that just repeats the last command as previously executed.

aprilsmartt commented 3 years ago

If you want to repeat a command in the terminal, try pressing the “up arrow key + ENTER”. This worked for me. Hope this helps. :)

macintacos commented 3 years ago

@aprilsmartt this is about VSCode commands, not terminal commands.

kxnyshk commented 3 years ago

@aprilsmartt heyy, thanks for this! I was actually looking for the Terminal one, found it here. Glad! Cheers :)

adriancuadrado commented 2 years ago

3 years have passed since this issue was first opened. Any progress?

alexn-s commented 2 years ago

is there any progress on this matter? would love to have a command id which i can use for a keybinding to quickly repeat my last action. it would be easier than to redo some weird shortcuts with 5 fingers in crazy positions

Mytakeon commented 2 years ago

For those looking to do this for terminal commands, it is now possible with the shell integration, you can do it in two steps: open the "run recent command" panel (which you can bind to ctrl+r for example), then press enter: . The commandId is workbench.action.terminal.runRecentCommand. https://code.visualstudio.com/docs/terminal/shell-integration#_run-recent-command

Richiban commented 1 year ago

I would also very much appreciate this after getting used to having it in editors like Vim or Helix.

Just to be clear, ctrl + shift + P, enter works but only if you actually executed the command through the command palette in the first place. For me this is an important distinction; I want a key I can press to repeat anything, even trivial commands such as cursorUp or workbench.action.closeActiveEditor. Is there a history of executed commands? If so, I would be nice to be able to repeat whatever the last one was.

roryfahy commented 1 year ago

is this change being considered?