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.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui