I am trying to output the contents of a file opened in vim ex mode to stdout.
vi -es +'%write !tee' +'q' ./testfile
Unfortunately, it does not write anything, although if I open the file in ex mode, like this:
vi -e ./testfile
and issue the same command:
:%write !tee
then the file contents are shown.
Of course, there are other vi commands I would issue before writing to stdout but first I would like to make this one work.
Note: I also tried the print
and list
commands, however, they replace tabs (and I want to keep them as they are in the file).
%p
there, so I think it has the shortcoming that tabs won't work as you mentioned... – filbranden♦ Mar 14 '20 at 14:29