Closed ayamir closed 1 year ago
Great! We can also take this opportunity to optimize the lazy-loading sequences of several plugins.
Nice! I'm also doing some work on lazy.nvim with my personal config. Glad to hear this!
IMO the loading sequence is a bit chaotic at present. I will make a diagram to sort out the relationship. (for example, a plugin that is not lazy-loaded requires a plugin that is lazy-loaded)
Maybe we need to make a dashboard to keep track of every issue?
Maybe we need to make a dashboard to keep track of every issue?
how
I mean sth like this lol https://github.com/ayamir/nvimdots/issues/242 Just get everything we need to do listed.
@CharlesChiuGit @ayamir This is the final dependency diagram (Click to enlarge, I plan to add this to the wiki):
Legend:
┌─┐ ┌─┐
│A│ ──────────► │B│ Arrow indicates "B is loaded after A"
└─┘ └─┘
┌─┐ ┌─┐
│A│ ─ ─ ─ ─► │B│ Dashed line indicates "B depends on A, or A must be loaded before B"
└─┘ └─┘
There are three major issues (Represented by red arrow):
nvim-cmp
wilder.nvim
and fzy-lua-native
are interdependentefmls-configs-nvim
requires a lazy-loaded plugin```diag digraph plugins_load_seq { ratio = fill; node [style=filled]; init -> opt [color="0.649 0.701 0.701"]; init -> start [color="0.649 0.701 0.701"]; init -> "self-contained" [color="0.649 0.701 0.701"]; "nvim-lspconfig" -> "efmls-configs-nvim" [color="0.348 0.839 0.839" style="dashed"]; start -> "efmls-configs-nvim" [color="0.002 0.999 0.999"]; start -> "mason-lspconfig.nvim" [color="0.649 0.701 0.701"]; start -> "mason-tool-installer.nvim" [color="0.649 0.701 0.701"]; "mason-lspconfig.nvim" -> "mason.nvim" [color="0.649 0.701 0.701" style="dashed"]; "mason-tool-installer.nvim" -> "mason.nvim" [color="0.649 0.701 0.701" style="dashed"]; start -> "which-key.nvim" [color="0.649 0.701 0.701"]; start -> "nvim-web-devicons" [color="0.649 0.701 0.701"]; start -> "nord.nvim" [color="0.649 0.701 0.701"]; start -> "edge" [color="0.649 0.701 0.701"]; start -> "catppuccin" [color="0.649 0.701 0.701"]; start -> "nvim-notify" [color="0.649 0.701 0.701"]; start -> "nvim-comment" [color="0.649 0.701 0.701"]; start -> "dressing.nvim" [color="0.649 0.701 0.701"]; opt -> BufWinEnter [color="0.619 0.714 0.714"]; opt -> BufNewFile [color="0.619 0.714 0.714"]; BufWinEnter -> VimEnter [color="0.619 0.714 0.714"]; VimEnter -> UIEnter [color="0.619 0.714 0.714"]; UIEnter -> BufReadPre [color="0.619 0.714 0.714"]; BufReadPre -> BufReadPost [color="0.619 0.714 0.714"]; BufReadPost -> LspAttach [color="0.619 0.714 0.714"]; LspAttach -> InsertEnter [color="0.619 0.714 0.714"]; BufWinEnter -> "accelerated-jk.nvim" [color="0.649 0.701 0.701"]; BufWinEnter -> "alpha-nvim" [color="0.649 0.701 0.701"]; BufNewFile -> "gitsigns.nvim" [color="0.649 0.701 0.701"]; VimEnter -> "copilot.lua" [color="0.649 0.701 0.701"]; "copilot.lua" -> "copilot-cmp" [color="0.649 0.701 0.701"]; UIEnter -> "toggleterm.nvim" [color="0.649 0.701 0.701"]; BufReadPre -> "nvim-lspconfig" [color="0.649 0.701 0.701"]; "nvim-lspconfig" -> "lspsaga.nvim" [color="0.649 0.701 0.701"]; "nvim-lspconfig" -> "lsp_signature.nvim" [color="0.649 0.701 0.701"]; "nvim-lspconfig" -> "lualine.nvim" [color="0.649 0.701 0.701"]; "lspsaga.nvim" -> "lualine.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "vim-illuminate" [color="0.649 0.701 0.701"]; BufReadPost -> "nvim-treesitter" [color="0.649 0.701 0.701"]; BufReadPost -> "clever-f.vim" [color="0.649 0.701 0.701"]; BufReadPost -> "hop.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "neoscroll.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "better-escape.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "nvim-bufdel" [color="0.649 0.701 0.701"]; BufReadPost -> "stabilize.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "smartyank.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "vim-im-select (opt)" [color="0.649 0.701 0.701"]; BufReadPost -> "project.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "gitsigns.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "indent-blankline.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "bufferline.nvim" [color="0.649 0.701 0.701"]; BufReadPost -> "nvim-scrollview" [color="0.649 0.701 0.701"]; BufReadPost -> "fidget.nvim" [color="0.649 0.701 0.701"]; "nvim-treesitter" -> "nvim-treesitter-textobjects" [color="0.649 0.701 0.701"]; "nvim-treesitter-textobjects" -> "nvim-ts-rainbow" [color="0.649 0.701 0.701"]; "nvim-ts-rainbow" -> "nvim-ts-context-commentstring" [color="0.649 0.701 0.701"]; "nvim-ts-context-commentstring" -> "nvim-ts-hint-textobject" [color="0.649 0.701 0.701"]; "nvim-ts-hint-textobject" -> "nvim-ts-autotag" [color="0.649 0.701 0.701"]; "nvim-ts-autotag" -> "vim-matchup" [color="0.649 0.701 0.701"]; "vim-matchup" -> "nvim-colorizer.lua" [color="0.649 0.701 0.701"]; InsertEnter -> "nvim-cmp" [color="0.649 0.701 0.701"]; InsertEnter -> "vim-cool" [color="0.649 0.701 0.701"]; InsertEnter -> "tabout.nvim" [color="0.649 0.701 0.701"]; "lspkind.nvim" -> "nvim-cmp" [color="0.649 0.701 0.701" style="dashed"]; "LuaSnip" -> "cmp_luasnip" [color="0.348 0.839 0.839" style="dashed"]; "cmp-under-comparator" -> "nvim-cmp" [color="0.649 0.701 0.701" style="dashed"]; "cmp_luasnip" -> "cmp-nvim-lsp" [color="0.649 0.701 0.701" style="dashed"]; "cmp-nvim-lsp" -> "cmp-nvim-lua" [color="0.649 0.701 0.701" style="dashed"]; "cmp-nvim-lua" -> "cmp-tmux" [color="0.649 0.701 0.701" style="dashed"]; "cmp-tmux" -> "cmp-path" [color="0.649 0.701 0.701" style="dashed"]; "cmp-path" -> "cmp-spell" [color="0.649 0.701 0.701" style="dashed"]; "cmp-spell" -> "cmp-buffer" [color="0.649 0.701 0.701" style="dashed"]; "cmp-buffer" -> "cmp-latex-symbols" [color="0.649 0.701 0.701" style="dashed"]; "cmp-latex-symbols" -> "cmp-tabnine (opt)" [color="0.649 0.701 0.701" style="dashed"]; "cmp-tabnine (opt)" -> "nvim-cmp" [color="0.649 0.701 0.701" style="dashed"]; "nvim-cmp" -> "LuaSnip" [color="0.002 0.999 0.999"]; "friendly-snippets" -> "LuaSnip" [color="0.649 0.701 0.701" style="dashed"]; "nvim-cmp" -> "nvim-autopairs" [color="0.649 0.701 0.701"]; LspAttach -> "neodim" [color="0.649 0.701 0.701"]; "nvim-treesitter" -> "neodim" [color="0.649 0.701 0.701" style="dashed"]; "self-contained" -> "vim-easy-align" [color="0.649 0.701 0.701"]; "self-contained" -> "auto-session" [color="0.649 0.701 0.701"]; "self-contained" -> "nvim-dap" [color="0.649 0.701 0.701"]; "nvim-dap" -> "nvim-dap-ui" [color="0.649 0.701 0.701"]; "self-contained" -> "vim-fugitive" [color="0.649 0.701 0.701"]; "self-contained" -> "specs.nvim" [color="0.649 0.701 0.701"]; "self-contained" -> "diffview.nvim" [color="0.649 0.701 0.701"]; "self-contained" -> "vim-go" [color="0.649 0.701 0.701"]; "plenary.nvim" -> "rust-tools.nvim" [color="0.649 0.701 0.701" style="dashed"]; "self-contained" -> "rust-tools.nvim" [color="0.649 0.701 0.701"]; "self-contained" -> "orgmode.nvim" [color="0.649 0.701 0.701"]; "self-contained" -> "markdown-preview.nvim" [color="0.649 0.701 0.701"]; "self-contained" -> "csv.vim" [color="0.649 0.701 0.701"]; "self-contained" -> "plenary.nvim" [color="0.649 0.701 0.701"]; "plenary.nvim" -> "popup.nvim" [color="0.649 0.701 0.701"]; "popup.nvim" -> "telescope-undo.nvim" [color="0.649 0.701 0.701" style="dashed"]; "telescope-undo.nvim" -> "telescope.nvim" [color="0.649 0.701 0.701" style="dashed"]; "plenary.nvim" -> "telescope.nvim" [color="0.649 0.701 0.701" style="dashed"]; "telescope.nvim" -> "telescope-fzf-native.nvim" [color="0.649 0.701 0.701"]; "telescope-fzf-native.nvim" -> "telescope-frecency.nvim" [color="0.649 0.701 0.701"]; "sqlite.lua" -> "telescope-frecency.nvim" [color="0.649 0.701 0.701" style="dashed"]; "telescope-frecency.nvim" -> "telescope-zoxide" [color="0.649 0.701 0.701"]; "telescope-zoxide" -> "telescope-live-grep-args.nvim" [color="0.649 0.701 0.701"]; "self-contained" -> "sniprun" [color="0.649 0.701 0.701"]; "self-contained" -> "vim-startuptime" [color="0.649 0.701 0.701"]; "fzy-lua-native" -> "wilder.nvim" [color="0.649 0.701 0.701" style="dashed"]; "wilder.nvim" -> "fzy-lua-native" [color="0.002 0.999 0.999"]; "self-contained" -> "wilder.nvim" [color="0.649 0.701 0.701"]; "dressing.nvim" -> "legendary.nvim" [color="0.649 0.701 0.701" style="dashed"]; "sqlite.lua" -> "legendary.nvim" [color="0.649 0.701 0.701" style="dashed"]; "which-key.nvim" -> "legendary.nvim" [color="0.649 0.701 0.701" style="dashed"]; "self-contained" -> "legendary.nvim" [color="0.649 0.701 0.701"]; "self-contained" -> "nvim-tree.lua" [color="0.649 0.701 0.701"]; "nvim-window-picker" -> "nvim-tree.lua" [color="0.649 0.701 0.701" style="dashed"]; "self-contained" -> "trouble.nvim" [color="0.649 0.701 0.701"]; opt [color="0.650 0.200 1.000"]; start [color="0.650 0.200 1.000"]; "self-contained" [color="0.650 0.200 1.000"]; "efmls-configs-nvim" [color="0.650 0.200 1.000"]; "nvim-lspconfig" [color="0.408 0.498 1.000"]; "mason-lspconfig.nvim" [color="0.650 0.200 1.000"]; "mason-tool-installer.nvim" [color="0.650 0.200 1.000"]; "mason.nvim" [color="0.650 0.200 1.000"]; "nvim-comment" [color="0.650 0.200 1.000"]; "which-key.nvim" [color="0.650 0.200 1.000"]; "nvim-web-devicons" [color="0.650 0.200 1.000"]; "nord.nvim" [color="0.650 0.200 1.000"]; "edge" [color="0.650 0.200 1.000"]; "catppuccin" [color="0.650 0.200 1.000"]; "nvim-notify" [color="0.650 0.200 1.000"]; "lspsaga.nvim" [color="0.650 0.200 1.000"]; "lsp_signature.nvim" [color="0.650 0.200 1.000"]; "nvim-cmp" [color="0.650 0.200 1.000"]; "lspkind.nvim" [color="0.650 0.200 1.000"]; "cmp-under-comparator" [color="0.650 0.200 1.000"]; "LuaSnip" [color="0.408 0.498 1.000"]; "cmp_luasnip" [color="0.650 0.200 1.000"]; "cmp-nvim-lsp" [color="0.650 0.200 1.000"]; "cmp-nvim-lua" [color="0.650 0.200 1.000"]; "cmp-tmux" [color="0.650 0.200 1.000"]; "cmp-path" [color="0.650 0.200 1.000"]; "cmp-spell" [color="0.650 0.200 1.000"]; "cmp-buffer" [color="0.650 0.200 1.000"]; "cmp-tabnine (opt)" [color="0.650 0.200 1.000" shape=doubleoctagon]; "cmp-latex-symbols" [color="0.650 0.200 1.000"]; "friendly-snippets" [color="0.650 0.200 1.000"]; "nvim-autopairs" [color="0.650 0.200 1.000"]; "copilot.lua" [color="0.650 0.200 1.000"]; "copilot-cmp" [color="0.650 0.200 1.000"]; "vim-easy-align" [color="0.650 0.200 1.000"]; "vim-illuminate" [color="0.650 0.200 1.000"]; "nvim-treesitter" [color="0.650 0.200 1.000"]; "nvim-treesitter-textobjects" [color="0.650 0.200 1.000"]; "nvim-ts-rainbow" [color="0.650 0.200 1.000"]; "nvim-ts-context-commentstring" [color="0.650 0.200 1.000"]; "nvim-ts-hint-textobject" [color="0.650 0.200 1.000"]; "nvim-ts-autotag" [color="0.650 0.200 1.000"]; "vim-matchup" [color="0.650 0.200 1.000"]; "accelerated-jk.nvim" [color="0.650 0.200 1.000"]; "clever-f.vim" [color="0.650 0.200 1.000"]; "vim-cool" [color="0.650 0.200 1.000"]; "hop.nvim" [color="0.650 0.200 1.000"]; "neoscroll.nvim" [color="0.650 0.200 1.000"]; "toggleterm.nvim" [color="0.650 0.200 1.000"]; "nvim-colorizer.lua" [color="0.650 0.200 1.000"]; "auto-session" [color="0.650 0.200 1.000"]; "better-escape.nvim" [color="0.650 0.200 1.000"]; "nvim-dap" [color="0.650 0.200 1.000"]; "nvim-dap-ui" [color="0.650 0.200 1.000"]; "vim-fugitive" [color="0.650 0.200 1.000"]; "nvim-bufdel" [color="0.650 0.200 1.000"]; "specs.nvim" [color="0.650 0.200 1.000"]; "tabout.nvim" [color="0.650 0.200 1.000"]; "diffview.nvim" [color="0.650 0.200 1.000"]; "stabilize.nvim" [color="0.650 0.200 1.000"]; "smartyank.nvim" [color="0.650 0.200 1.000"]; "vim-im-select (opt)" [color="0.650 0.200 1.000" shape=doubleoctagon]; "vim-go" [color="0.650 0.200 1.000"]; "rust-tools.nvim" [color="0.650 0.200 1.000"]; "orgmode.nvim" [color="0.650 0.200 1.000"]; "markdown-preview.nvim" [color="0.650 0.200 1.000"]; "csv.vim" [color="0.650 0.200 1.000"]; "plenary.nvim" [color="0.650 0.200 1.000"]; "telescope.nvim" [color="0.650 0.200 1.000"]; "popup.nvim" [color="0.650 0.200 1.000"]; "telescope-undo.nvim" [color="0.650 0.200 1.000"]; "project.nvim" [color="0.650 0.200 1.000"]; "telescope-fzf-native.nvim" [color="0.650 0.200 1.000"]; "telescope-frecency.nvim" [color="0.650 0.200 1.000"]; "sqlite.lua" [color="0.650 0.200 1.000"]; "telescope-zoxide" [color="0.650 0.200 1.000"]; "telescope-live-grep-args.nvim" [color="0.650 0.200 1.000"]; "sniprun" [color="0.650 0.200 1.000"]; "trouble.nvim" [color="0.650 0.200 1.000"]; "vim-startuptime" [color="0.650 0.200 1.000"]; "wilder.nvim" [color="0.650 0.200 1.000"]; "legendary.nvim" [color="0.650 0.200 1.000"]; "dressing.nvim" [color="0.650 0.200 1.000"]; "neodim" [color="0.650 0.200 1.000"]; "lualine.nvim" [color="0.650 0.200 1.000"]; "alpha-nvim" [color="0.650 0.200 1.000"]; "nvim-tree.lua" [color="0.650 0.200 1.000"]; "nvim-window-picker" [color="0.650 0.200 1.000"]; "gitsigns.nvim" [color="0.650 0.200 1.000"]; "indent-blankline.nvim" [color="0.650 0.200 1.000"]; "bufferline.nvim" [color="0.650 0.200 1.000"]; "nvim-scrollview" [color="0.650 0.200 1.000"]; "fidget.nvim" [color="0.650 0.200 1.000"]; "fzy-lua-native" [color="0.650 0.200 1.000"]; BufReadPre [color="0.590 0.273 1.000"]; BufWinEnter [color="0.590 0.273 1.000"]; BufReadPost [color="0.590 0.273 1.000"]; InsertEnter [color="0.590 0.273 1.000"]; VimEnter [color="0.590 0.273 1.000"]; UIEnter [color="0.590 0.273 1.000"]; BufNewFile [color="0.590 0.273 1.000"]; LspAttach [color="0.590 0.273 1.000"]; } ```
@CharlesChiuGit I also tested the issue in https://github.com/ayamir/nvimdots/discussions/300. In fact, this startup time is reasonable - the OS needs to store the nvim
machine code in memory and read the file content to be opened at the same time, which will require a lot of disk IO. Meanwhile, the BufReadPost
event cannot utilize the time after drawing the dashboard to load the 17 plugins (found after viewing the log, this cannot be observed in daily use), which will block the main thread for \~1.5s.
There are also several minor factors, including waiting for the language server to start and obtaining sqlite
data, which will also be completed at this time.
@CharlesChiuGit I also tested the issue in #300. In fact, this startup time is reasonable - the OS needs to store the
nvim
machine code in memory and read the file content to be opened at the same time, which will require a lot of disk IO. Meanwhile, theBufReadPost
event cannot utilize the time after drawing the dashboard to load the 17 plugins (found after viewing the log, this cannot be observed in daily use), which will block the main thread for ~1.5s.There are also several minor factors, including waiting for the language server to start and obtaining
sqlite
data, which will also be completed at this time.
Very interesting! Seems like it's A LOT to do during this migration. Hope lazy.nvim can alleviate some constrains.
Almost finished with roughly load sequency settings and works fine. https://github.com/ayamir/nvimdots/pull/425
@CharlesChiuGit I also tested the issue in #300. In fact, this startup time is reasonable - the OS needs to store the
nvim
machine code in memory and read the file content to be opened at the same time, which will require a lot of disk IO. Meanwhile, theBufReadPost
event cannot utilize the time after drawing the dashboard to load the 17 plugins (found after viewing the log, this cannot be observed in daily use), which will block the main thread for ~1.5s.There are also several minor factors, including waiting for the language server to start and obtaining
sqlite
data, which will also be completed at this time.
I recently got a new machine at work, which is a Ryzen 7 7700x with 32GB of gen4 ram and M.2 nvme. The startup time is super fast! No lagging at all. So I guess the hardware does matter at some degree, even though nvim is a pretty light weight program.
Feature description
lazy.nvim provides more advanced features than
Packer.nvim
. So I want to migrate tolazy.nvim
now.Additional information
No response