compile directly from vim

后端 未结 6 1177
独厮守ぢ
独厮守ぢ 2021-01-31 05:43

I\'d like to compile cpp file w/o turning off vi.
I know the :!g++ file.cpp but I prefer :make so I added this line in .vimrc file

6条回答
  •  别那么骄傲
    2021-01-31 06:30

    First of all, just make the bloody make file. Every tool out there is expecting to work with make and if your compilations are that simple it takes about 30 seconds to write a make file that compiles all c and cpp files into an executable.

    Second, if you refuse to use a make file then try

    :help system
    

    That should give you enough info to come up with your own command similar to this

    :com Mymake call system("g++ ".expand("%"))
    

提交回复
热议问题