从vim中运行PHP文件

前端之家收集整理的这篇文章主要介绍了从vim中运行PHP文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
是否可以从 vim中运行 PHP文件?我试图在这里做的是有一个快捷方式,所以每当我需要运行我正在编辑的文件时跳过退出vim并手动调用PHP解释器
是!你可以做你想做的事.都从vim中运行PHP,并创建一个快捷方式.

Matthew Weier O’Phinney写道:

Probably the most useful thing I’ve
done as a PHP developer is to add
mappings to run the current file
through (a) the PHP interpreter (using
Ctrl-M),and (b) the PHP interpreter’s
linter (using Ctrl-L).

Vim Productivity Tips for PHP Developers

例:

:autocmd FileType PHP noremap <C-M> :w!<CR>:!/usr/bin/PHP %<CR>

或者(这不检查文件类型要小心)

:map <C-M> :w!<CR>:!/usr/bin/PHP %<CR>

Joe’Zonker’Brockmeier写道:

Vim also allows you to execute a
command directly from the editor,
without needing to drop to a shell,by
using bang (!) followed by the command
to be run. For instance,if you’re
editing a file in Vim and want to find
out how many words are in the file,
run

:! wc %

Vim tips: Working with external commands

原文链接:https://www.f2er.com/bash/385219.html

猜你在找的Bash相关文章