This is due to this question:
How to redirect the output of an ex command to the current buffer or file?
However, the problem with use :rediris that 3 or 4 additional lines of a new line are output before the output, and it is difficult to remove them using the replace function.
For example, if I do the following:
:redir @a
:pwd
:redir END
The content @aconsists of three blank lines and then the normal expected output.
I tried to publish a process with something like this:
:let @b = substitute(@a, '\s*\(.\{-}\)\s*', '\1', '')
But the result is that it @bhas the same content as @a.
Does anyone know a more efficient (i.e. working) post-process method or replacement for :redirone that doesn't have these extra lines?