Skip to content

Commit

Permalink
perf(plugins): add 'UIEnter' for lazy event (#285)
Browse files Browse the repository at this point in the history
* perf(plugins): add 'UIEnter' for lazy plugin

* perf(plugins): move 'toggleterm.nvim', 'undotree', 'neogen' to user plugins

* fix(neo-tree.nvim): fix UIEnter
  • Loading branch information
linrongbin16 authored Oct 17, 2023
1 parent 980fa5d commit df002b4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
4 changes: 2 additions & 2 deletions lua/configs/nvim-neo-tree/neo-tree-nvim/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ vim.api.nvim_create_autocmd("FileType", {
set_key("n", "<leader>,", "<cmd>vertical resize -10<cr>", opts)
end,
})
vim.api.nvim_create_autocmd("VimEnter", {
vim.api.nvim_create_autocmd({ "VimEnter", "UIEnter" }, {
group = "neo_tree_augroup",
callback = function(data)
-- use defer_fn to open async
Expand All @@ -205,4 +205,4 @@ vim.api.nvim_create_autocmd("VimEnter", {
end
vim.defer_fn(open_impl, 0)
end,
})
})
38 changes: 8 additions & 30 deletions lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local BufReadPre = "BufReadPre"
local CmdlineEnter = "CmdlineEnter"
local VimEnter = "VimEnter"
local InsertEnter = "InsertEnter"
local UIEnter = "UIEnter"

local M = {
-- ---- INFRASTRUCTURE ----
Expand Down Expand Up @@ -96,7 +97,7 @@ local M = {
},
{
"nvim-neo-tree/neo-tree.nvim",
event = { VimEnter },
event = { UIEnter },
dependencies = { "MunifTanjim/nui.nvim" },
branch = "v3.x",
config = lua_config("nvim-neo-tree/neo-tree.nvim"),
Expand All @@ -111,7 +112,7 @@ local M = {
{
"akinsho/bufferline.nvim",
version = "v3.*",
event = { VeryLazy, BufReadPre, BufNewFile },
event = { UIEnter },
dependencies = { "moll/vim-bbye" },
config = lua_config("akinsho/bufferline.nvim"),
keys = lua_keys("akinsho/bufferline.nvim"),
Expand All @@ -130,12 +131,12 @@ local M = {
-- Statusline
{
"linrongbin16/lsp-progress.nvim",
event = { VimEnter },
event = { UIEnter },
config = lua_config("linrongbin16/lsp-progress.nvim"),
},
{
"nvim-lualine/lualine.nvim",
event = { VimEnter },
event = { UIEnter },
dependencies = { "linrongbin16/lsp-progress.nvim" },
config = lua_config("nvim-lualine/lualine.nvim"),
},
Expand Down Expand Up @@ -163,7 +164,7 @@ local M = {
-- UI improvement
{
"stevearc/dressing.nvim",
event = { VeryLazy, BufReadPre, BufNewFile },
event = { UIEnter },
dependencies = { "junegunn/fzf" },
config = lua_config("stevearc/dressing.nvim"),
},
Expand Down Expand Up @@ -250,7 +251,7 @@ local M = {
},
{
"hrsh7th/cmp-buffer",
event = { VeryLazy, InsertEnter, CmdlineEnter },
event = { VeryLazy, InsertEnter },
},
{
"FelipeLema/cmp-async-path",
Expand All @@ -269,7 +270,7 @@ local M = {
},
{
"hrsh7th/cmp-cmdline",
event = { VeryLazy, InsertEnter, CmdlineEnter },
event = { VeryLazy, CmdlineEnter },
},
{
"hrsh7th/nvim-cmp",
Expand Down Expand Up @@ -399,29 +400,6 @@ local M = {
config = lua_config("axieax/urlview.nvim"),
keys = lua_keys("axieax/urlview.nvim"),
},
-- Terminal
{
"akinsho/toggleterm.nvim",
version = "*",
event = { VeryLazy, CmdlineEnter },
config = lua_config("akinsho/toggleterm.nvim"),
keys = lua_keys("akinsho/toggleterm.nvim"),
},
-- Generate documents
{
"danymat/neogen",
cmd = { "Neogen" },
dependencies = { "L3MON4D3/LuaSnip" },
config = lua_config("danymat/neogen"),
keys = lua_keys("danymat/neogen"),
},
-- Undo tree
{
"mbbill/undotree",
event = { VeryLazy, CmdlineEnter },
init = lua_init("mbbill/undotree"),
keys = lua_keys("mbbill/undotree"),
},
}

return M
25 changes: 24 additions & 1 deletion lua/plugins/users_sample.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
-- local CmdlineEnter = "CmdlineEnter"
-- local VimEnter = "VimEnter"
-- local InsertEnter = "InsertEnter"
-- local UIEnter = "UIEnter"
--
-- return {
-- -- Context
Expand Down Expand Up @@ -87,6 +88,28 @@
-- config = lua_config("Pocco81/auto-save.nvim"),
-- keys = lua_keys("Pocco81/auto-save.nvim"),
-- },
-- Terminal({
-- "akinsho/toggleterm.nvim",
-- version = "*",
-- event = { VeryLazy, CmdlineEnter },
-- config = lua_config("akinsho/toggleterm.nvim"),
-- keys = lua_keys("akinsho/toggleterm.nvim"),
-- }),
-- -- Generate documents
-- {
-- "danymat/neogen",
-- cmd = { "Neogen" },
-- dependencies = { "L3MON4D3/LuaSnip" },
-- config = lua_config("danymat/neogen"),
-- keys = lua_keys("danymat/neogen"),
-- },
-- -- Undo tree
-- {
-- "mbbill/undotree",
-- event = { VeryLazy, CmdlineEnter },
-- init = lua_init("mbbill/undotree"),
-- keys = lua_keys("mbbill/undotree"),
-- },
-- }

return {}
return {}

0 comments on commit df002b4

Please sign in to comment.