aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_init_packages.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/_init_packages.lua')
-rw-r--r--runtime/lua/vim/_init_packages.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/runtime/lua/vim/_init_packages.lua b/runtime/lua/vim/_init_packages.lua
index 0c4ee8636d..4a961970cc 100644
--- a/runtime/lua/vim/_init_packages.lua
+++ b/runtime/lua/vim/_init_packages.lua
@@ -42,13 +42,23 @@ function vim._load_package(name)
return nil
end
--- Insert vim._load_package after the preloader at position 2
-table.insert(package.loaders, 2, vim._load_package)
+-- TODO(bfredl): dedicated state for this?
+if vim.api then
+ -- Insert vim._load_package after the preloader at position 2
+ table.insert(package.loaders, 2, vim._load_package)
+end
-- builtin functions which always should be available
require('vim.shared')
-vim._submodules = { inspect = true }
+vim._submodules = {
+ inspect = true,
+ version = true,
+ fs = true,
+ iter = true,
+ re = true,
+ text = true,
+}
-- These are for loading runtime modules in the vim namespace lazily.
setmetatable(vim, {
@@ -78,6 +88,6 @@ function vim.empty_dict()
end
-- only on main thread: functions for interacting with editor state
-if not vim.is_thread() then
+if vim.api and not vim.is_thread() then
require('vim._editor')
end