簡體   English   中英

無法為neovim中運行的程序提供輸入

[英]Can't give input to programs ran in neovim

當我運行用C ++或python編寫的代碼時,無法將Input輸入程序。 對於C ++

#include <stdio.h>

int main(){
    int test;
    scanf("%d", &test);
    printf("%d\n", test);
    return 0;
}

產出

:!g++ -o run test.cpp && ./run  2>&1| tee /tmp/nvimPNNwAf/3                                                                                            
32767

(1 of 1): 32767

對於python3

test = input()

產出

:!python3 test.py                                                                                                                                      
Traceback (most recent call last):
  File "test.py", line 1, in <module>
  test = input()
EOFError: EOF when reading a line

shell returned 1

我知道我可以使用:term ,它將解決此問題。 但是我在:term上遇到問題。

當我輸入:

3
10 12 3 9
10 12 7 2
13 11 5 6

它應該看起來像:

3
10 12 3 9
10 12 7 2
13 11 5 6
33
-1
83

但是,它輸出:

3                       
10 12 3 9    
10 13                   
2 7 2    
13 11 5 6      
1             
1

如何解決此問題? (這在Vim中沒有發生)

對於您問題的第一部分,這不是什么大問題,而是一個功能,因為在neovim中禁用了交互式外殼,您可以在此GitHub問題https://github.com/neovim/neovim/issues/1496上看到justimk答案。解決方案是在neovim外部調用程序或使用插件來執行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM