mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
docs: misc #28970
This commit is contained in:
@ -1,17 +1,19 @@
|
||||
-- Nvim-Lua stdlib: the `vim` module (:help lua-stdlib)
|
||||
--
|
||||
-- Lua code lives in one of three places:
|
||||
-- 1. runtime/lua/vim/ (the runtime): For "nice to have" features, e.g. the
|
||||
-- `inspect` and `lpeg` modules.
|
||||
-- 2. runtime/lua/vim/shared.lua: pure Lua functions which always
|
||||
-- are available. Used in the test runner, as well as worker threads
|
||||
-- and processes launched from Nvim.
|
||||
-- 3. runtime/lua/vim/_editor.lua: Code which directly interacts with
|
||||
-- the Nvim editor state. Only available in the main thread.
|
||||
-- Lua code lives in one of four places:
|
||||
-- 1. Plugins! Not everything needs to live on "vim.*". Plugins are the correct model for
|
||||
-- non-essential features which the user may want to disable or replace with a third-party
|
||||
-- plugin. Examples: "editorconfig", "comment".
|
||||
-- - "opt-out": runtime/plugin/*.lua
|
||||
-- - "opt-in": runtime/pack/dist/opt/
|
||||
-- 2. runtime/lua/vim/ (the runtime): Lazy-loaded modules. Examples: `inspect`, `lpeg`.
|
||||
-- 3. runtime/lua/vim/shared.lua: pure Lua functions which always are available. Used in the test
|
||||
-- runner, as well as worker threads and processes launched from Nvim.
|
||||
-- 4. runtime/lua/vim/_editor.lua: Eager-loaded code which directly interacts with the Nvim
|
||||
-- editor state. Only available in the main thread.
|
||||
--
|
||||
-- Guideline: "If in doubt, put it in the runtime".
|
||||
--
|
||||
-- Most functions should live directly in `vim.`, not in submodules.
|
||||
-- The top level "vim.*" namespace is for fundamental Lua and editor features. Use submodules for
|
||||
-- everything else (but avoid excessive "nesting"), or plugins (see above).
|
||||
--
|
||||
-- Compatibility with Vim's `if_lua` is explicitly a non-goal.
|
||||
--
|
||||
@ -19,9 +21,7 @@
|
||||
-- - https://github.com/luafun/luafun
|
||||
-- - https://github.com/rxi/lume
|
||||
-- - http://leafo.net/lapis/reference/utilities.html
|
||||
-- - https://github.com/torch/paths
|
||||
-- - https://github.com/bakpakin/Fennel (pretty print, repl)
|
||||
-- - https://github.com/howl-editor/howl/tree/master/lib/howl/util
|
||||
|
||||
-- These are for loading runtime modules lazily since they aren't available in
|
||||
-- the nvim binary as specified in executor.c
|
||||
|
Reference in New Issue
Block a user