2

Lets say I run the external very_long_taking_command like this:

:!very_long_taking_command

and I get the output in this Vim Terminal where it says "Press ENTER or type command to continue".

When I press ENTER it goes away. But what if I want to see the output again? What do I do? I don't want to run the command again...

2 Answers 2

1

I would do:

:term very_long_taking_command

If your very_long_taking_command is dos command you could have to do:

:term cmd /c very_long_taking_dos_command

Remark: if it is very long and you don't want to freeze Vim you could use an asynchronous runner like asyncrun and do:

:AsyncRun very_long_taking_command
:cw

Popular options are:

7
  • that is definitely the best way, but there was also a way which you could do after executing the command^^
    – Bog
    Oct 11, 2023 at 13:03
  • I'm afraid if the command ran in a dos box or shell box the output is lost after the shell quit :-| Oct 11, 2023 at 13:07
  • 1
    I am like 95% sure there was a way. I learned that years ago when I started using vim but completely forgot about it and just remembered recently. I will let you know if I find it again :)
    – Bog
    Oct 11, 2023 at 16:08
  • Omg found it: g<. It was in one really really old vim_notes.md file on my backup server :DD
    – Bog
    Oct 11, 2023 at 16:19
  • Nice! but for a shell command on Windows at least it do not display the output of the command, only the command itself. Oct 11, 2023 at 16:23
1

The Solution is to use g<.

From the Official Vim Documentation:

If you accidentally hit <Enter> or <Space> and you want to see the displayed text then use g<. This only works when 'more' is set.

Read more: :help g<


Note: Works in Neovim only. In gVim + Windows it only shows you the command not the output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.