简体   繁体   中英

How to correctly set Vim's makeprg (Windows)

In Linux, I've used this au FileType c set makeprg=gcc\\ -o\\ %< in my .vimrc to set my default compiler for .c files, and this: nmap <F5> :<CU>silent make %<CR>:redraw!<CR>:!./%<<CR> to bind F5 key to make things faster.

How should I do this on Windows? I've tried with au FileType c set makeprg="cmd /c C:\\tcc\\tcc.exe -o %<" and some few other samples, but none have worked.

In brief: I want to hit F5 to compile&run program in cmd or cmd with errors that compiler gave.

I'd appreciate any hints how to get this thing work on Windows. Thanks.

There is no need to include cmd.exe on 'makeprg' . The line you use in Linux should work fine if gcc is in your path.

Another approach could be using Single Compile plugin to simplify the mapping to F5 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM