加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

从vim中运行PHP文件

发布时间:2020-12-15 18:26:51 所属栏目:安全 来源:网络整理
导读:是否可以从 vim中运行 PHP文件?我试图在这里做的是有一个快捷方式,所以每当我需要运行我正在编辑的文件时跳过退出vim并手动调用PHP解释器 是!你可以做你想做的事.都从vim中运行PHP,并创建一个快捷方式. Matthew Weier O’Phinney写道: Probably the most u
是否可以从 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读