84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
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?
Linux 下
:%w !tee | php
解释一下:
Vim 的 w 命令后的参数可以用来指定保存的路径。我们在此使用 !tee 命令是使用 shell 的进程替换让 w 命令写入到管道供后面无论任何命令使用。
!tee
w
---------
@felix021 指出,可以不用进程替换,直接让 w 写入到 php 的标准输入即可。
:%w !php
Linux 下
解释一下:
Vim 的 w 命令后的参数可以用来指定保存的路径。我们在此使用
!tee
命令是使用 shell 的进程替换让w
命令写入到管道供后面无论任何命令使用。---------
@felix021 指出,可以不用进程替换,直接让
w
写入到 php 的标准输入即可。