Skip to content

Commit

Permalink
fix(plugin): don't load if read from stdin (#450)
Browse files Browse the repository at this point in the history
* fix(plugin): don't load if read from stdin

As this plugin now uses StdinReadPre, user shouldn't lazy-load this
plugin

* fix(plugin): use augroup id
  • Loading branch information
mangkoran authored May 5, 2024
1 parent 1c8b82c commit 8055f8b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions plugin/dashboard.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
-- version 0.2.3
if vim.g.loaded_dashboard then
return
end

vim.g.loaded_dashboard = 1
local g = vim.api.nvim_create_augroup('dashboard', { clear = true })

vim.api.nvim_create_autocmd('StdinReadPre', {
group = g,
callback = function()
vim.g.read_from_stdin = 1
end,
})

vim.api.nvim_create_autocmd('UIEnter', {
group = vim.api.nvim_create_augroup('Dashboard', { clear = true }),
group = g,
callback = function()
if vim.fn.argc() == 0 and vim.api.nvim_buf_get_name(0) == '' then
if
vim.fn.argc() == 0
and vim.api.nvim_buf_get_name(0) == ''
and vim.g.read_from_stdin == nil
then
require('dashboard'):instance()
end
end,
Expand Down

0 comments on commit 8055f8b

Please sign in to comment.