aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index ea43b93b30..6aed84aba5 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1410,6 +1410,12 @@ static void read_stdin(void)
int save_msg_didany = msg_didany;
set_buflisted(true);
(void)open_buffer(true, NULL, 0); // create memfile and read file
+ if (BUFEMPTY() && curbuf->b_next != NULL) {
+ // stdin was empty, go to buffer 2 (e.g. "echo file1 | xargs nvim"). #8561
+ do_cmdline_cmd("silent! bnext");
+ // Delete the empty stdin buffer.
+ do_cmdline_cmd("bwipeout 1");
+ }
no_wait_return = false;
msg_didany = save_msg_didany;
TIME_MSG("reading stdin");