Outputting a processed shell command buffer to a new buffer in Vim? E499: empty filename for "%" or "#", only works with ": p: h"

This thread here discusses putting the output of shell commands into a new buffer in vim, but it doesn't discuss it using the current buffer, like

 %new | r !%gcut -d '"' -f2,4,6,8,10

      

where the percentage sign %

tries to use the current buffer, unfortunately resulting in

E499: Empty file name for '%' or '#', only works with ":p:h"

      

So

How can I pipe a buffer edited in the shell to a new buffer in Vim?

+3


source to share


1 answer


:new | r !gcut -d '"' -f2,4,6,8,10 #

      

#

is a placeholder for "previous file".



If you have spaces in the filename, use quotes

:new | r !gcut -d '"' -f2,4,6,8,10 "#"

      

+3


source







All Articles