Skip to main content
Grammatical errors
Source Link

My current keybinding for compiling cpp files is:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out<CR>

When I press F2, vim escapes to the shell and a.out executes well uptil taking input. But, it does not give anywait for output and returns back to the editor. This never happened earlier when I typed the command manually. Vim waited, vim used to wait for me to read the output and then I got a line saying: "Press ENTER or type command to continue."

[Update] I changed the command to:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out

Now when I press F2, it finally writes :!./a.out below and I manually press Enter. This time it actually waits for me in the terminal. Why is this happening.?

Try reproducing by using both the keybindings this one and the former.

My current keybinding for compiling cpp files is:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out<CR>

When I press F2, vim escapes to the shell and a.out executes well uptil taking input. But, it does not give any output and returns back to the editor. This never happened earlier when I typed the command manually. Vim waited for me to read the output and then I got a line saying: "Press ENTER or type command to continue."

[Update] I changed the command to:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out

Now when I press F2, it finally writes :!./a.out below and I manually press Enter. This time it actually waits for me. Why is this happening. Try reproducing by using both the keybindings this one and the former.

My current keybinding for compiling cpp files is:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out<CR>

When I press F2, vim escapes to the shell and a.out executes well uptil taking input. But, it does not wait for output and returns back to the editor. This never happened earlier when I typed the command manually, vim used to wait for me to read the output and then I got a line saying: "Press ENTER or type command to continue."

[Update] I changed the command to:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out

Now when I press F2, it finally writes :!./a.out below and I manually press Enter. This time it actually waits for me in the terminal. Why is this happening?

Try reproducing by using both the keybindings this one and the former.

I updated changes made by me.
Source Link

My current keybinding for compiling cpp files is:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out<CR>

When I run itpress F2, vim escapes to the shell and a.out executes well uptilluptil taking input. But, it does not give amyany output and returns back to the codeeditor. This never happened earlier when I typed the command manually. Vim waited for me to read the output and then I got a line saying: "Press EnterENTER or type command to exit"continue."

[Update] I changed the command to:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out

Now when I press F2, it finally writes :!./a.out below and I manually press Enter. This time it actually waits for me. Why is this happening. Try reproducing by using both the keybindings this one and the former.

My current keybinding for compiling cpp files is:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out<CR>

When I run it, vim escapes to the shell and a.out executes well uptill taking input. But it does not give amy output and returns back to the code. This never happened earlier. Vim waited for me to read the output and then I got a line saying "Press Enter to exit".

My current keybinding for compiling cpp files is:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out<CR>

When I press F2, vim escapes to the shell and a.out executes well uptil taking input. But, it does not give any output and returns back to the editor. This never happened earlier when I typed the command manually. Vim waited for me to read the output and then I got a line saying: "Press ENTER or type command to continue."

[Update] I changed the command to:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out

Now when I press F2, it finally writes :!./a.out below and I manually press Enter. This time it actually waits for me. Why is this happening. Try reproducing by using both the keybindings this one and the former.

Source Link

Cannot read output of ./a.out

My current keybinding for compiling cpp files is:

autocmd filetype cpp nnoremap <F2> :!g++ -g %<CR>:!./a.out<CR>

When I run it, vim escapes to the shell and a.out executes well uptill taking input. But it does not give amy output and returns back to the code. This never happened earlier. Vim waited for me to read the output and then I got a line saying "Press Enter to exit".