wiki/notebook/editor.neovim.lua-modules.org
2022-04-20 19:05:37 +08:00

1.3 KiB

Neovim Lua modules

  • Neovim will load the requires files from its runtime paths; see runtimepath from the Neovim help system
  • built on top of the already existing Lua modules system
  • while searching for the runtime paths, Neovim will search for certain folders

    • plugin/ will load all of the Lua files that are placed in that subdirectory
    • lua/ also contains Lua files but does not automatically load until some other module will call require to that module
    • init.lua is basically the index.html for HTML files, default.nix for Nix language, or mod.rs for Rust language
  • in module names that are require'd, . is treated as a separator and representing as a directory in the file tree; e.g., when running require("custom.plugins"), custom.plugins should have a module at $RUNTIMEPATH/lua/custom/plugins/init.lua
  • at some point, Neovim can make use of more Lua modules with Luarocks