Re: How to write a map for gcc?

2007-05-22 Thread Swaroop C H

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?


See `:help :make` and `:help compiler-select` and `:help :map`


Re: How to write a map for gcc?

2007-05-22 Thread Mark Woodward
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.outcr


cheers,


-- 
Mark