[英]Set vimrc makeprg to custom script if no Makefile
I want the :make
command to execute normally if there is a Makefile
present. 如果存在Makefile
,我希望:make
命令正常执行。 Otherwise I want it to execute a custom script, say, called compile
. 否则我希望它执行一个自定义脚本,比如称为compile
。 If neither file is present, I'd like it to fail gracefully (ideally not leave the editing screen). 如果两个文件都不存在,我希望它优雅地失败(理想情况下不会离开编辑屏幕)。
I'm aware of this thread , which presents a bash expression I was able to adapt to suit my needs. 我知道这个帖子 ,它提供了一个bash表达式,我能够适应我的需要。 EXCEPT I sometimes need to run a shell other than bash. 除了我有时需要运行除bash之外的shell。 Is there a shell-independent way to do this? 是否有与shell无关的方法来执行此操作?
makeprg
can be set to the name of any executable. makeprg
可以设置为任何可执行文件的名称。 Make a shell script that runs make
if there is a Makefile, otherwise run compile
, or else return. 如果有Makefile,请创建一个运行make
的shell脚本,否则运行compile
,否则返回。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.