nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.48k stars 212 forks source link

Neorg doubles my neovim loading time #593

Closed SingularisArt closed 1 year ago

SingularisArt commented 2 years ago

Prerequisites

Neovim Version

NVIM v0.8.0-dev-1131-gad1f353fe1

Neorg setup

local neorg = require("neorg")

neorg.setup({
  load = {
    ["core.defaults"] = {}, -- Load all the default modules
    ["core.export"] = {},
    ["core.norg.completion"] = {
      config = {
        engine = "nvim-cmp",
      },
    },
    ["core.looking-glass"] = {}, -- Enable the looking_glass module
    ["core.export.markdown"] = {
      config = {
        extensions = "all",
      },
    },
    -- ["external.kanban"] = {},
    -- ["external.zettelkasten"] = {},
    -- ["external.context"] = {},
    ["core.norg.concealer"] = {
      config = {
        -- markup_preset = "dimmed",
        -- markup_preset = "conceal",
        markup_preset = "varied",
        icon_preset = "diamond",
        icons = {
          marker = {
            enabled = true,
            icon = " ",
          },
          todo = {
            enable = true,
            pending = {
              -- icon = ""
              icon = "",
            },
            uncertain = {
              icon = "?",
            },
            urgent = {
              icon = "",
            },
            on_hold = {
              icon = "",
            },
            cancelled = {
              icon = "",
            },
          },
          heading = {
            enabled = true,
            level_1 = {
              icon = "◈",
            },

            level_2 = {
              icon = " ◇",
            },

            level_3 = {
              icon = "  ◆",
            },
            level_4 = {
              icon = "   ❖",
            },
            level_5 = {
              icon = "    ⟡",
            },
            level_6 = {
              icon = "     ⋄",
            },
          },
        },
      },
    },

    ["core.presenter"] = {
      config = {
        zen_mode = "zen-mode",
        slide_count = {
          enable = true,
          position = "top",
          count_format = "[%d/%d]",
        },
      },
    },

    ["core.norg.esupports.metagen"] = {
      config = {
        type = "auto",
      },
    },

    ["core.keybinds"] = {
      config = {
        default_keybinds = true,
        neorg_leader = "<Leader>",
      },
    },

    ["core.norg.dirman"] = { -- Manage your directories with Neorg
      config = {
        workspaces = {
          home = "~/Documents/school-notes/notes",
          personal = "~/Documents/school-notes/personal",
          college = "~/Documents/school-notes/college",
        },
        index = "index.norg",
        --[[ autodetect = true,
                  autochdir = false, ]]
      },
    },

    ["core.norg.qol.toc"] = {
      config = {
        close_split_on_jump = false,
        toc_split_placement = "left",
      },
    },

    ["core.norg.journal"] = {
      config = {
        workspace = "home",
        journal_folder = "journal",
        use_folders = false,
      },
    },
  },
})

Actual behavior

It takes about 170 milliseconds for neovim to load without neorg. It takes about 300 milliseconds for neovim to load with neorg.

Expected behavior

I expect neovim to load without causing such an increase in neovim.

Steps to reproduce

local status_ok, packer = pcall(require, "packer")
if not status_ok then
  return
end

return packer.startup(function(use)
  -- Plugin Mangager
  use "wbthomason/packer.nvim"
  use "nvim-lua/plenary.nvim"
  use "nvim-neorg/neorg"
end)

Potentially conflicting plugins

No response

Other information

No response

Help

No

Implementation help

No response

vhyrro commented 2 years ago

Have you tried lazy loading? I recommend e.g. ft = "norg" in packer. 130 milliseconds really isn't a lot for something as big as Neorg.

SingularisArt commented 2 years ago

I did that and it went from 170 milliseconds to 210 milliseconds which isn't bad at all. Also, I keep getting this error:

Unable to load module core.norg.dirman - ...module.lua:36: module 'plenary.scandir' not found:
^Ino field package.preload['plenary.scandir']
^Ino file './plenary/scandir.lua'
^Ino file '/usr/share/luajit-2.1.0-beta3/plenary/scandir.lua'
^Ino file '/usr/local/share/lua/5.1/plenary/scandir.lua'
^Ino file '/usr/local/share/lua/5.1/plenary/scandir/init.lua'
^Ino file '/usr/share/lua/5.1/plenary/scandir.lua'
^Ino file '/usr/share/lua/5.1/plenary/scandir/init.lua'
^Ino file './plenary/scandir.so'
^Ino file '/usr/local/lib/lua/5.1/plenary/scandir.so'
^Ino file '/usr/lib/lua/5.1/plenary/scandir.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'
^Ino file './plenary.so'
^Ino file '/usr/local/lib/lua/5.1/plenary.so'
^Ino file '/usr/lib/lua/5.1/plenary.s
vhyrro commented 2 years ago

That error is cause Neorg needs plenary.nvim at nvim-lua/plenary.nvim. If you install that as well everything should be smooth sailing!

SingularisArt commented 2 years ago

I have it installed already tho.

katawful commented 2 years ago

Is it loaded before neorg or installed with the require key in packer.nvim?

SingularisArt commented 2 years ago

It's loaded before neorg with the require key.

d-r-a-b commented 1 year ago

@SingularisArt is this still an issue for you?

SingularisArt commented 1 year ago

@d-r-a-b Yes. It still takes about 80-90 milliseconds more to load with Neorg.

d-r-a-b commented 1 year ago

Thanks for your response!

From @vhyrro 's comments above

Have you tried lazy loading? I recommend e.g. ft = "norg" in packer. 130 milliseconds really isn't a lot for something as big as Neorg.

On that basis, it seems appropriate to close this as wontfix

vhyrro commented 1 year ago

Yup, marking this as wontfix. Neorg already loads faster than the average blink of an eye! :p