diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-11-05 18:43:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-05 18:43:00 +0100 |
commit | d17e508796be60eefe4a597df62de1fd9e7e1725 (patch) | |
tree | 31079372c1a12846700955af1dd0dcddf3449a6a /src/nvim/lua/vim.lua | |
parent | 0227091fb91a5ece94d6e95778912d02b23f77bb (diff) | |
parent | 1b0e4a5906d3c9fcb4290f943c7b048b3c35353b (diff) | |
download | rneovim-d17e508796be60eefe4a597df62de1fd9e7e1725.tar.gz rneovim-d17e508796be60eefe4a597df62de1fd9e7e1725.tar.bz2 rneovim-d17e508796be60eefe4a597df62de1fd9e7e1725.zip |
Merge pull request #13227 from bfredl/earlyinspect
lua: make vim.inspect available early so it can be used for path debugging
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r-- | src/nvim/lua/vim.lua | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index 85d39eaef4..0580fcacae 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -36,6 +36,9 @@ local vim = vim assert(vim) +vim.inspect = package.loaded['vim.inspect'] +assert(vim.inspect) + -- Internal-only until comments in #8107 are addressed. -- Returns: -- {errcode}, {output} @@ -107,10 +110,6 @@ for s in (package.cpath..';'):gmatch('[^;]*;') do end function vim._load_package(name) - -- tricky: when debugging this function we must let vim.inspect - -- module to be loaded first: - --local inspect = (name == "vim.inspect") and tostring or vim.inspect - local basename = name:gsub('%.', '/') local paths = {"lua/"..basename..".lua", "lua/"..basename.."/init.lua"} for _,path in ipairs(paths) do @@ -260,10 +259,7 @@ end -- These are for loading runtime modules lazily since they aren't available in -- the nvim binary as specified in executor.c local function __index(t, key) - if key == 'inspect' then - t.inspect = require('vim.inspect') - return t.inspect - elseif key == 'treesitter' then + if key == 'treesitter' then t.treesitter = require('vim.treesitter') return t.treesitter elseif require('vim.uri')[key] ~= nil then |