It happens quite often to me, that while entering a complex command I realize that I need to enter some other commands first.
Being a vi
user, I'd love to 0 D, enter a different command and later paste the deleted command line. Unfortunally, nobody (including myself) bothered to implement c&p-Registers in the vi
mode of zsh
.
So right now I Insert some x
at the beginning of the command to make it fail, do my other stuff, fecth the old command from the history and remove the x
. And each time I ask myself: Is there some easier way to do the same thing?
Not a duplicate! Please note that I mentioned I‘m using vi mode. None of the answers of the other question works for vi mode. They are only for emacs mode, even if they don‘t mention, so they are misleading. Please reopen so people can find the correct answer.
#
in front of the line, and adds it to the command line history." Thisone liner
from accepted answer is quite lost in all this. And the idea works for bash and emacs mode, too. – Oct 14 '19 at 22:14