Olivier
Olivier

Reputation: 2111

Running a program in Vim with output in the same window

I wrote a makefile to compile my code in vim with

:make

Now I don't want to do

:! ./program_name

because it takes too long. What is fast way to run and compile my code and see it in the same window in vim? Is it possible to have the output of my program in copen? or is that only for errors.

Upvotes: 0

Views: 359

Answers (2)

Ingo Karkat
Ingo Karkat

Reputation: 172540

Once you've issued ! ./program_name, you can quickly repeat it with :!!. You can even combine this with :make|!!.

Upvotes: 0

Wei Shi
Wei Shi

Reputation: 5055

You can set the default rule in Makefile to compile and run together.

default: app run

app: $(OBJECTS)
    $(CC) $(CFLAGS) -o $@ $(OBJECTS)

run:
    ./app

Upvotes: 0

Related Questions