English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I know many will say to not mess with it if I don't know what I'm doing.
I'd like to set a macro in VI so that while in command mode, if I type something, say "gcc", it will run the following command:

!gcc % && a.out

Not that it is too horribly time consuming to type that or just !! to repeat that each time... I was just wanting to learn what my possibilities were. Is it something that needs to go in my .exrc file? Thanks.

2007-10-17 13:35:24 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

Just open up the .exrc file or create your own file and use the map command. Here is an example of how to setup your macro:

map !gcc % && a.out^M

Good luck.

2007-10-17 14:01:58 · answer #1 · answered by Anonymous · 0 0

i love VI! it's the best editor, really! I don't use any other IDE.

i would recommend to write a Makefile:

all:
gcc *.c && ./a.out

(replace the with a tabulator, and NOT with spaces!)

now just type :make in vi.

The advantage of a makefile is that vi now lists the errors during compilation. with :cl you can list errors, with :cn vi jumps to the next error, and you can immediately edit the line.

2007-10-17 20:25:45 · answer #2 · answered by cruppstahl 4 · 0 0

I haven't used VI editor since 1994 but it is nice to see the name again.

2007-10-17 13:38:30 · answer #3 · answered by shipwreck 7 · 0 0

fedest.com, questions and answers