updates :3
This commit is contained in:
parent
5eec7f512f
commit
b61ff7e2f4
15 changed files with 488 additions and 456 deletions
|
|
@ -139,89 +139,6 @@ in {
|
|||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require('config.lazy')
|
||||
|
||||
local dashboardImage = vim.api.nvim_create_augroup("DashboardImage", { clear = true })
|
||||
local img = require("image").from_file("${./NeoVim.png}")
|
||||
local is_visible = false
|
||||
|
||||
-- Known image dimensions
|
||||
local IMG_WIDTH = 50 -- characters
|
||||
local IMG_HEIGHT = 14 -- lines
|
||||
|
||||
-- Debug notification function
|
||||
local function debug_notify(message)
|
||||
-- vim.notify(message, vim.log.levels.INFO)
|
||||
end
|
||||
|
||||
-- Function to calculate centered position
|
||||
local function center_image()
|
||||
local win_width = vim.o.columns
|
||||
local win_height = vim.o.lines
|
||||
|
||||
local x = math.floor((win_width - IMG_WIDTH) / 2)
|
||||
local y = math.floor((win_height - IMG_HEIGHT) / 6)
|
||||
|
||||
return math.max(0, x), math.max(0, y)
|
||||
end
|
||||
|
||||
-- Function to update image position
|
||||
local function update_image()
|
||||
debug_notify("Attempting to update image. is_visible = " .. tostring(is_visible))
|
||||
if is_visible then
|
||||
local x, y = center_image()
|
||||
debug_notify("Positioning image at x=" .. x .. ", y=" .. y)
|
||||
img:clear()
|
||||
img:render()
|
||||
img:move(x, y)
|
||||
end
|
||||
end
|
||||
|
||||
-- Show image on both VimEnter and when dashboard buffer is created
|
||||
vim.api.nvim_create_autocmd({ "VimEnter", "BufWinEnter", "BufEnter" }, {
|
||||
group = dashboardImage,
|
||||
callback = function(ev)
|
||||
local filetype = vim.api.nvim_buf_get_option(ev.buf, "filetype")
|
||||
debug_notify("Event triggered: " .. ev.event .. ", filetype: " .. filetype)
|
||||
if filetype == "dashboard" then
|
||||
debug_notify("Dashboard detected, setting visible")
|
||||
is_visible = true
|
||||
vim.schedule(update_image)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Handle window resize
|
||||
vim.api.nvim_create_autocmd("VimResized", {
|
||||
group = dashboardImage,
|
||||
callback = function()
|
||||
debug_notify("Window resized")
|
||||
update_image()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Clear image when leaving dashboard
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
group = dashboardImage,
|
||||
callback = function()
|
||||
debug_notify("Leaving buffer")
|
||||
is_visible = false
|
||||
img:clear()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Catch when returning to dashboard
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = dashboardImage,
|
||||
pattern = "dashboard",
|
||||
callback = function()
|
||||
debug_notify("FileType dashboard detected")
|
||||
is_visible = true
|
||||
vim.schedule(update_image)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Initial debug message
|
||||
debug_notify("Dashboard image setup loaded")
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue