skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.86k stars 111 forks source link

how to compile and run python that accepts input? #100

Open talfryn opened 6 years ago

talfryn commented 6 years ago

when i use AsyncRun! python % i get the following error

RuntimeError: input(): lost sys.stdin
[Finished in 1 seconds with code 1]

how to compile and run python that accepts input?

skywind3000 commented 6 years ago

quickfix window can't take any input, so stdin is closed when job starts to prevent child process hang if it is waiting input.

Please update to the latest AsyncRun, it supports "range" feature which will enable AsyncRun takes a range of lines in the current buffer as stdin.

try:

:%AsyncRun cat

the whole buffer will be the input of command cat. and

:10,20AsyncRun cat

text between line 10-20 will be taken as stdin.

:'<,'>AsyncRun cat

The visual selection (line-wise) will be taken as stdin.