微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐