ryche
ryche

Reputation: 2094

Compile and run C program in Vim

I wrote simple mapping that compiles and run C program. It makes what I wanted, but it returns to vim immediately after program finish execution without waiting me to press Enter. How can I fix this?

map <leader>b :!clear && gcc % -o %< && ./%<<CR>

Upvotes: 1

Views: 1816

Answers (1)

phd
phd

Reputation: 94453

Implement waiting in shell: add read at the end of your command line:

clear && gcc % -o %< && ./%< && read

Upvotes: 3

Related Questions