mirror of
https://github.com/neovim/neovim.git
synced 2025-12-07 15:14:04 +00:00
startup: go to buffer 2 if stdin is empty
If stdin is not a TTY we read it into buffer 1, as text. But if the
stdin pipe is empty, Nvim was most likely invoked for some other reason.
DWIM: select buffer 2 (if it exists). Example:
echo file1 | xargs nvim
closes #8560
closes #8561
ref https://github.com/equalsraf/neovim-qt/issues/417
This commit is contained in:
@@ -122,6 +122,18 @@ describe('startup', function()
|
||||
{ 'ohyeah', '' }))
|
||||
end)
|
||||
|
||||
it('goes to buffer 2 if stdin is empty #8561', function()
|
||||
eq('\r\n 1u# "[No Name]" line 1\r\n 2 %a "file1" line 0\r\n 3 "file2" line 0',
|
||||
funcs.system({nvim_prog, '-n', '-u', 'NONE', '-i', 'NONE', '--headless',
|
||||
'+ls!',
|
||||
'+qall!',
|
||||
'-',
|
||||
'file1',
|
||||
'file2',
|
||||
},
|
||||
{ '' }))
|
||||
end)
|
||||
|
||||
it('-e/-E interactive #7679', function()
|
||||
clear('-e')
|
||||
local screen = Screen.new(25, 3)
|
||||
|
||||
Reference in New Issue
Block a user