如何执行我正在Vi(m)中编辑的文件 [英] How to execute file I'm editing in Vi(m)

查看:93
本文介绍了如何执行我正在Vi(m)中编辑的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何执行我正在Vi(m)中编辑的文件并在拆分窗口中获取输出(例如在SciTE中)?

How to execute file that I'm editing in Vi(m) and get output in split window (like in SciTE)?

我当然可以这样执行:

:!scriptname

但是有可能避免编写脚本名称以及如何在拆分窗口而不是屏幕底部获取输出?

But is it posible to avoid writing script name and how to get output in split window instead just bottom of the screen?

推荐答案

make命令.它运行在makeprg选项中设置的命令.使用%作为当前文件名的占位符.例如,如果您正在编辑python脚本:

There is the make command. It runs the command set in the makeprg option. Use % as a placeholder for the current file name. For example, if you were editing a python script:

:set makeprg=python\ %

是的,您需要逃脱空间.之后,您可以简单地运行:

Yes, you need to escape the space. After this you can simply run:

:make

如果愿意,可以设置autowrite选项,它将在运行makeprg之前自动保存:

If you wish, you can set the autowrite option and it will save automatically before running the makeprg:

:set autowrite

这解决了执行部分.不知道有什么方法可以将输出输出到不涉及文件重定向的拆分窗口中.

This solves the execute part. Don't know any way of getting that output into a split window that doesn't involve redirection to file.

这篇关于如何执行我正在Vi(m)中编辑的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆