This is very similar to how-to-run-bash-command-over-current-file-and-replace-buffer-with-result
But I need to know how I can access current buffer when the file does not exist? i.e.
- I open vim
- goto insert mode e,g, press :
i - paste a json, possibly incomplete
- Run the command
!% jq
For now I get output as error from jq.
:%! jq– Peter Rincker Jan 02 '18 at 15:47%!. Even an unnamed, unsaved buffer. I have tested and verified that:%!jq '.'works to prettify JSON. – Peter Rincker Jan 02 '18 at 16:31E499: Empty file name for '%' or '#', only works with ":p:h"when I try this oh! just figured out! @PeterRincker is correct i was using!%when it should be%!– comdotlinux Jan 02 '18 at 17:13