aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_editor.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-09-01 13:01:24 -0700
committerGitHub <noreply@github.com>2024-09-01 13:01:24 -0700
commit61e9137394fc5229e582a64316c2ffef55d8d7af (patch)
treec0f380b5efa26bed8c13d2d7b192c0c89568222a /runtime/lua/vim/_editor.lua
parent6913c5e1d975a11262d08b3339d50b579e6b6bb8 (diff)
downloadrneovim-61e9137394fc5229e582a64316c2ffef55d8d7af.tar.gz
rneovim-61e9137394fc5229e582a64316c2ffef55d8d7af.tar.bz2
rneovim-61e9137394fc5229e582a64316c2ffef55d8d7af.zip
docs: misc #28970
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r--runtime/lua/vim/_editor.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index c7c8362bfb..7b5570cc99 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -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