Skip to content

Adding Compilation Flags for Certain Filetypes

Hong Xu edited this page Oct 27, 2013 · 2 revisions

Sometimes you just need more compilation flags for your source files. You can automate this by using :SCCompileAF and :SCCompileRunAF. For example, if one needs to link libz for all C source, you could add the following lines to your vimrc:

autocmd Filetype c nmap <buffer> <F9> :SCCompileAF -lz <CR>
autocmd Filetype c nmap <buffer> <F10> :SCCompileRunAF -lz <CR>

In this way, pressing would compile the C source file with an additional -lz flag and pressing would compile and run the binary.

This issue was first raised by @vivekiitkgp in #41.