How to run unsaved code when editing PHP with vim
某草草
某草草 2017-05-16 16:42:53
0
1
673

I use vim to edit php files. If you save them, you can use !php% to run the current file
But I want to verify the accuracy of the code without saving it. Is this possible?

某草草
某草草

reply all(1)
Peter_Zhu

Under Linux

:%w !tee | php

Explain:

The parameter after Vim’s w command can be used to specify the saving path. We use the !tee 命令是使用 shell 的进程替换让 w command here to write to the pipe for use by any subsequent commands.

---------

@felix021 pointed out that you can directly write w to the standard input of php without process replacement.

:%w !php
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template