Browse Source

fix:

- Run PackerSync instead of PackerInstall on first launch
  - Do not try to call Dashboard on first launch
my-config
NTBBloodbath 3 years ago
parent
commit
f26c989178
No known key found for this signature in database GPG Key ID: 18D6730BC846AAC5
  1. 13
      init.lua
  2. 19
      lua/doom/core/autocmds/init.lua

13
init.lua

@ -36,9 +36,16 @@ async = vim.loop.new_async(vim.schedule_wrap(function()
-- Load Doom core
require('doom.core')
-- If the current buffer name is empty then trigger Dashboard
if vim.api.nvim_buf_get_name(0):len() == 0 then
vim.cmd('Dashboard')
-- If the dashboard plugin is already installed and the packer_compiled.lua
-- file exists so we can make sure that the dashboard have been loaded
local compiled_plugins_path = vim.fn.expand(
'$HOME/.config/doom-nvim/plugin/packer_compiled.lua'
)
if vim.fn.filereadable(compiled_plugins_path) > 0 then
-- If the current buffer name is empty then trigger Dashboard
if vim.api.nvim_buf_get_name(0):len() == 0 then
vim.cmd('Dashboard')
end
end
vim.opt.shadafile = ''

19
lua/doom/core/autocmds/init.lua

@ -47,7 +47,24 @@ end
-- Install plugins on launch
if Doom.auto_install_plugins then
vim.defer_fn(function()
vim.cmd('PackerInstall')
-- Check if there is only packer installed so we can decide if we should
-- use PackerInstall or PackerSync, useful for generating the
-- `plugin/packer_compiled.lua` on first doom launch
if
vim.tbl_count(
vim.fn.globpath(
vim.fn.stdpath('data') .. '/site/pack/packer/opt',
'*',
0,
1
)
) == 1
then
vim.cmd('PackerSync')
else
-- Install the plugins
vim.cmd('PackerInstall')
end
end, 200)
end

Loading…
Cancel
Save