Vim Edits How php Runs Unsaved Code

  question, vim

I use vim to edit php files, if saved can be used! Php% to run the current file
But I don’t want to save, verify the accuracy of the code, can it be realized?

Under Linux

:%w !tee | php

Explain:

The parameters after Vim’s W command can be used to specify the saved path. We use it here.! teeThe command is to use the shell’s process to replace thewCommands are written to the pipeline for use by any subsequent command.

———

@felix021 pointed out that it is possible to directly let without process replacement.wWrite to php’s standard input.

:%w !php