problem with "useing gvim as a IDE"

帖子: 10
注册时间: 2008-05-27 11:54
送出感谢: 0
接收感谢: 0

problem with "useing gvim as a IDE"


帖子 momodi » 2008-06-29 10:16

There is a problem I tryed to solve many times, but all failed.

Could anyone help me?

When I want to run a problem, I could samplely add this code in my
vimrc file.

map <F9> :call CR()<CR><space>
func CR()
exec "update"
exec "g++ %<.cpp -o %< && ./ %<"

But, there is a bug with this method.

when I run this program:

while (1) {


I press F9, then vim will print foo endless.
I pressed ctrl+c, but it didn't work.

so I change that code to this:

map <F10> :call CR2()<CR><space>
func CR2()
exec "update"
exec "!xterm -e \"g++ %<.cpp -o %< && time ./%< ; read -n 1\""

But there is always a problem:
when I pressed ctrl+c, the problem will be ended.
but the windows will be closed too.
Then I couldn't see what my program have printed.

I tryed to use gnome-terminal to instead of xterm, but failed.

回到 “Vim和Emacs”