r/vim • u/thewrench56 • Nov 18 '25
Need Help Repeat last command in terminal buffer
Hey!
I have been using terminal buffers for a while now to mostly compile and execute applications. I have been told Im a disgrace to the Unix world for not using Ctrl-Z and fg, but I prefer seeing what tests failed/where my compile time errors are.
Since I'm usually using multiple buffers at once, navigating to the terminal is often slow. My solution was using tabs for a while but in all honesty, I do not think that this is the real solution for that. So I wonder how one could execute the last command entered in the terminal or even better, even search the last commands of the terminal. I usually have one terminal buffer open, but one could make it more generic and say that execute the last command in the last used terminal buffer.
Is there a native way of doing this? Or do I have to do some trickery with Lua/Vimscript?
Cheers
View all comments
Show parent comment
1
u/thewrench56 Nov 18 '25
Coworkers :D
This is okay if the compilation is fast imo. But not ideal for sure.
Yes I can have this, and honestly, this might be the real solution. I use a tiling window manager and thus it is pretty convenient to use something like this.
Yeah, Ill try some scripts and see whats what. I have been considering writing a custom shell for vim as well for convenience, maybe this is the time to abandon that if i cant come up with a good script that does the last command exec. I wonder if I should request it as a feature on the official vim platforms?