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

后端 未结 13 1845
悲哀的现实
悲哀的现实 2020-12-04 05:45

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

Of course I could execute it like that:

:!scriptname
<         


        
13条回答
  •  生来不讨喜
    2020-12-04 06:03

    Vim 8 has an interactive terminal built in. To run the current bash script in a split pane:

    :terminal bash %
    

    or for short

    :ter bash %
    

    % expands to the current file name.

    From :help terminal:

    The terminal feature is optional, use this to check if your Vim has it:
        echo has('terminal')
    If the result is "1" you have it.
    

提交回复
热议问题