How to execute file I’m editing in Vi(m)

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

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)