Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lua/startup/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,16 @@ function startup.display(force)
autocmd BufLeave * lua require"startup".remove_buffer(vim.fn.getbufinfo()[1])
]])
vim.defer_fn(function()
vim.api.nvim_win_set_cursor(0, {
2,
2,
})
startup.buffer_nr = vim.api.nvim_get_current_buf()
local buf_lines = vim.api.nvim_buf_get_lines(0, 0, 2, false)
if buf_lines[2] == nil then
return
else
startup.buffer_nr = vim.api.nvim_get_current_buf()
vim.api.nvim_win_set_cursor(0, {
2,
2,
})
end
end, 1)
if force then
startup.buffer_nr = vim.api.nvim_get_current_buf()
Expand Down Expand Up @@ -600,7 +605,10 @@ function startup.setup(update)
)
if not vim.g.startup_disable_on_startup then
vim.cmd(
[[autocmd VimEnter * lua if vim.fn.argc() == 0 then require("startup").display() end
[[autocmd VimEnter * lua for _, v in pairs(vim.v.argv) do if v == '-' then vim.g.read_from_stdin = 1 break end end]]
)
vim.cmd(
[[autocmd VimEnter * lua if vim.fn.argc() == 0 and vim.api.nvim_buf_get_name(0) == '' and vim.g.read_from_stdin == nil then require("startup").display() end
autocmd BufRead * lua if vim.fn.argc() == 0 then require("startup").display() end]]
)
vim.cmd(
Expand Down