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

后端 未结 13 1809
悲哀的现实
悲哀的现实 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:11

    Vim has ! ("bang") command which executes shell command directly from VIM window. Moreover it allows launching sequence of commands that are connected with pipe and read stdout.

    For example:

    ! node %
    

    is equivalent to opening command prompt window and launching commands:

    cd my_current_directory 
    node my_current_file
    

    See "Vim tips: Working with external commands" for details.

提交回复
热议问题