problem with "useing gvim as a IDE"

Vim、Emacs配置和使用
回复
momodi
帖子: 10
注册时间: 2008-05-27 11:54
送出感谢: 0
接收感谢: 0
联系:

problem with "useing gvim as a IDE"

#1

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

Hi
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 %< && ./ %<"
endfunc

But, there is a bug with this method.

when I run this program:

while (1) {
printf("foo\n");

}

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”