Hi TJ, On Tue, 2007-05-22 at 21:56 -0500, Ting Jiang wrote: > Hi, everyone: > > I am a beginner user of vim and I use it to write my C/C++ code in > Ubuntu. Every time I finished a C code and I want to compile it, I have > to type: > > :gcc -o mycfile.out mycfile.c > > How can I map this command to a shortcut key like F12? > > Thanks a lot. > > TJ >
To compile: nnoremap <F12> :!cc -o %:t:r.out %<cr> To run: nnoremap <F11> :!./%:t:r.out<cr> cheers, -- Mark