mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-01 16:44:49 +02:00
fix(news): dont show news when it has never been viewed (new install)
This commit is contained in:
parent
5b89bc8cbf
commit
6b9ee963e2
1 changed files with 17 additions and 5 deletions
|
@ -15,6 +15,9 @@ end
|
||||||
function M.setup()
|
function M.setup()
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
if Config.news.lazyvim then
|
if Config.news.lazyvim then
|
||||||
|
if not Config.json.data.news["NEWS.md"] then
|
||||||
|
M.welcome()
|
||||||
|
end
|
||||||
M.lazyvim(true)
|
M.lazyvim(true)
|
||||||
end
|
end
|
||||||
if Config.news.neovim then
|
if Config.news.neovim then
|
||||||
|
@ -23,6 +26,10 @@ function M.setup()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.welcome()
|
||||||
|
Util.info("Welcome to LazyVim!")
|
||||||
|
end
|
||||||
|
|
||||||
function M.changelog()
|
function M.changelog()
|
||||||
M.open("CHANGELOG.md", { plugin = "LazyVim" })
|
M.open("CHANGELOG.md", { plugin = "LazyVim" })
|
||||||
end
|
end
|
||||||
|
@ -55,23 +62,28 @@ function M.open(file, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
if opts.when_changed then
|
if opts.when_changed then
|
||||||
|
local is_new = not Config.json.data.news[ref]
|
||||||
local hash = M.hash(file)
|
local hash = M.hash(file)
|
||||||
if hash == Config.json.data.news[ref] then
|
if hash == Config.json.data.news[ref] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
Config.json.data.news[ref] = hash
|
Config.json.data.news[ref] = hash
|
||||||
Util.json.save()
|
Util.json.save()
|
||||||
|
-- don't open if file has never been opened
|
||||||
|
if is_new then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local float = require("lazy.util").float({
|
local float = require("lazy.util").float({
|
||||||
file = file,
|
file = file,
|
||||||
size = { width = 0.6, height = 0.6 },
|
size = { width = 0.6, height = 0.6 },
|
||||||
})
|
})
|
||||||
vim.wo[float.win].spell = false
|
vim.opt_local.spell = false
|
||||||
vim.wo[float.win].wrap = false
|
vim.opt_local.wrap = false
|
||||||
vim.wo[float.win].signcolumn = "yes"
|
vim.opt_local.signcolumn = "yes"
|
||||||
vim.wo[float.win].statuscolumn = " "
|
vim.opt_local.statuscolumn = " "
|
||||||
vim.wo[float.win].conceallevel = 3
|
vim.opt_local.conceallevel = 3
|
||||||
vim.diagnostic.disable(float.buf)
|
vim.diagnostic.disable(float.buf)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue