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

查看:22
本文介绍了如何执行我在 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天全站免登陆