如何执行我正在Vi(m)中编辑的文件 [英] How to execute file I'm editing in 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屋!