-
Notifications
You must be signed in to change notification settings - Fork 40.8k
Closed
Description
Describe the bug
When trying to initialize and use the uv
module in Neovim, I encountered an error indicating that the vim.uv
field is nil
. This issue arises when using the fs_stat
function to check if a path exists.
To Reproduce
- Use Neovim version
v0.9.5
. - Add the following code to
init.lua
:if not vim.uv.fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end end vim.opt.rtp:prepend(lazypath)
- Start Neovim.
Expected Behavior:
The uv
module should be initialized correctly, allowing the use of fs_stat
to check if a path exists.
Actual Behavior:
Neovim throws the following error:
E5113: Error while calling lua chunk: /home/kali/.config/nvim/init.lua:210: attempt to index field 'uv' (a nil value)
stack traceback:
/home/kali/.config/nvim/init.lua:210: in main chunk
Press ENTER or type command to continue
Desktop
- OS: Kali Linux
- Terminal: GNOME Terminal
Neovim Version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1719379426
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Additional Information:
Changing vim.uv
to vim.loop
resolves the issue:
local uv = vim.loop
if not uv.fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
error('Error cloning lazy.nvim:\n' .. out)
end
end
vim.opt.rtp:prepend(lazypath)
Please let me know if this is the intended usage or if there are any additional configurations required.
Metadata
Metadata
Assignees
Labels
No labels