mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lua/stdlib: cleanup
This commit is contained in:
parent
0a4ef38e43
commit
7df566060c
@ -8,8 +8,8 @@
|
|||||||
--
|
--
|
||||||
-- Guideline: "If in doubt, put it in the runtime".
|
-- Guideline: "If in doubt, put it in the runtime".
|
||||||
--
|
--
|
||||||
-- Most functions should live directly on `vim.`, not sub-modules. The only
|
-- Most functions should live directly in `vim.`, not in submodules.
|
||||||
-- "forbidden" names are those claimed by legacy `if_lua`:
|
-- The only "forbidden" names are those claimed by legacy `if_lua`:
|
||||||
-- $ vim
|
-- $ vim
|
||||||
-- :lua for k,v in pairs(vim) do print(k) end
|
-- :lua for k,v in pairs(vim) do print(k) end
|
||||||
-- buffer
|
-- buffer
|
||||||
@ -161,6 +161,16 @@ local function inspect(object, options) -- luacheck: no unused
|
|||||||
error(object, options) -- Stub for gen_vimdoc.py
|
error(object, options) -- Stub for gen_vimdoc.py
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Defers the wrapped callback until the Nvim API is safe to call.
|
||||||
|
---
|
||||||
|
--@see |vim-loop-callbacks|
|
||||||
|
local function schedule_wrap(cb)
|
||||||
|
return (function (...)
|
||||||
|
local args = {...}
|
||||||
|
vim.schedule(function() cb(unpack(args)) end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
local function __index(t, key)
|
local function __index(t, key)
|
||||||
if key == 'inspect' then
|
if key == 'inspect' then
|
||||||
t.inspect = require('vim.inspect')
|
t.inspect = require('vim.inspect')
|
||||||
@ -172,16 +182,6 @@ local function __index(t, key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Defers the wrapped callback until when the nvim API is safe to call.
|
|
||||||
---
|
|
||||||
--- See |vim-loop-callbacks|
|
|
||||||
local function schedule_wrap(cb)
|
|
||||||
return (function (...)
|
|
||||||
local args = {...}
|
|
||||||
vim.schedule(function() cb(unpack(args)) end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
local module = {
|
local module = {
|
||||||
_update_package_paths = _update_package_paths,
|
_update_package_paths = _update_package_paths,
|
||||||
_os_proc_children = _os_proc_children,
|
_os_proc_children = _os_proc_children,
|
||||||
|
Loading…
Reference in New Issue
Block a user