A Vim plugin making it more convenient to compile and run a single source file.
SingleCompile is a Vim plugin aimed at making it more convenient to compile or run a single source file without leaving Vim.
Consider this situation: you have just written a small C source file for a tiny test, but you have to write a Makefile to compile it, or exit Vim to compile it, or compile it using "!gcc" without quickfix feature because Vim's make command only use the "make" command? This plugin will help you out.
You can also find this plugin on GitHub and Vim Online. An online document is available here. There is also a simple tutorial available here.
Download the SingleCompile.zip file from this
page and extract it to your vim runtime
directory(~/.vim on UNIX/Linux and
$VIM_INSTALLATION_FOLDER\vimfiles on Windows).
add filetype plugin on
to your vimrc if you haven't done it.
After having SingleCompile installed, Add these key-mapping in your vimrc:
nmap <F9> :SCCompile<cr>
nmap <F10> :SCCompileRun<cr>
F9 and F10 can be replaced with other keys. Note that the two lines here should not have any trailing space. If your file type is supported, then press F9 to compile your source file, and press F10 to compile and run your source file. If there is a compilation error, and the quickfix feature is enabled, then you could use :cope command to see the error list. You may also use :SCChooseCompiler command to choose a compiler if you have more than one compiler available on you system. :SCViewResult will show you the last run output.
To see a list of builtin supported compilers and interpreters, check here. You can add your compiler or interpreter support if the compiler or interpreter you want is not in the list. See details in the help file SingleCompile.txt.
Check the wiki pages for some tricks.
There are some supporting code in this plugin for Marc Weber's vim-addon-actions: http://github.com/MarcWeber/vim-addon-actions
Feedback is welcome. If you find any bug or have some good ideas to improve this plugin, please feel free to submit it on the issue tracker.
If you've written some templates for some compilers or interpreters which are not included as built-in template, and you think they are useful for other people, you could send me an email to inform me, or make a pull request on GitHub, and I'll put them in the built-in templates. If you have any tips that you want to share with other people, feel free to add a wiki page.
Follow me on Twitter if you are interested in my development.