How do I dump output of an external command to a new buffer in Vim?

前端 未结 3 1314
醉梦人生
醉梦人生 2021-02-15 12:04

:enew lets me create a new buffer and :.!> lets me dump the output of an external command to that buffer. Can I combine the tw

3条回答
  •  走了就别回头了
    2021-02-15 12:25

    :vnew | read !

    Execute the command and place the output in a new vertically split buffer. Use # to pass the path of the current buffer to the command. e.g.

    :vnew | read !python -m json.tool #

    Using python's JSON module to format the working JSON file.

    Alternatively, the AsyncCommand plugin can be used to "run any program and load results in a split" buffer asynchronously.

    Additional reading:

    • :h new
    • :h read

提交回复
热议问题