Executing Python with Gvim

后端 未结 4 941
逝去的感伤
逝去的感伤 2020-12-06 13:04
  • open gVim.
  • then using the File Menu and MenuItem Open to open a file pi.py which has the following tiny script:

4条回答
  •  忘掉有多难
    2020-12-06 13:17

    You don't need to save the file, you can run the current buffer as stdin to a command such as python by typing:

    :w !python -
    

    (The hyphen at the end probably isn't necessary, python will generally use stdin by default)

    edit: seeing as you are new to vim, note that this will not save the file, it will just run it. You will probably want to learn how to save your file.

提交回复
热议问题