Browse Source

Fix issue with start screen overwriting :checkhealth in neovim-qt

Now only shows on the first buffer of a new vim instance
master
Adam Pippin 2 years ago
parent
commit
4634ebc633
  1. 21
      lua/module/start.lua

21
lua/module/start.lua

@ -1,9 +1,5 @@
local M = require('module'):new()
-- TODO: When enabled, and when in neovim-qt, this seems to overwrite :checkhealth.
-- Maybe track if it's been triggered _at all_ this session, and if so don't trigger
-- again.
function M:boot()
self.opts = {
win = {
@ -17,6 +13,8 @@ function M:boot()
}
self.is_gui = false
self.is_visible = false
self.target_win = nil
self.target_buf = nil
end
function M:run()
@ -29,6 +27,13 @@ function M:gui()
local win = vim.api.nvim_get_current_win()
local buf = vim.api.nvim_get_current_buf()
if (self.target_win == nil and self.target_buf == nil) then
self.target_win = win
self.target_buf = buf
elseif (self.target_win ~= win or self.target_buf ~= buf) then
return
end
self.is_gui = true
self.opts.win.list = vim.api.nvim_win_get_option(win, 'list')
@ -58,6 +63,14 @@ function M:show()
local win = vim.api.nvim_get_current_win()
local buf = vim.api.nvim_create_buf(true, true)
if (self.target_win == nil and self.target_buf == nil) then
self.target_win = win
self.target_buf = buf
elseif (self.target_win ~= win or self.target_buf ~= buf) then
return
end
self:draw(buf)
vim.api.nvim_buf_set_option(buf, "modified", false)

Loading…
Cancel
Save