fix: replace vim.* "requires" with explicit calls to vim functions (#1701)

This commit is contained in:
Alexander Courtis
2022-11-06 10:37:33 +11:00
committed by GitHub
parent 6d6a44626d
commit 8cc369695b
30 changed files with 263 additions and 321 deletions

View File

@@ -1,5 +1,3 @@
local uv = vim.loop
local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local lib = require "nvim-tree.lib"
@@ -9,12 +7,12 @@ local notify = require "nvim-tree.notify"
local M = {}
local function create_and_notify(file)
local ok, fd = pcall(uv.fs_open, file, "w", 420)
local ok, fd = pcall(vim.loop.fs_open, file, "w", 420)
if not ok then
notify.error("Couldn't create file " .. file)
return
end
uv.fs_close(fd)
vim.loop.fs_close(fd)
events._dispatch_file_created(file)
end
@@ -94,7 +92,7 @@ function M.fn(node)
if is_last_path_file and idx == num_nodes then
create_file(path_to_create)
elseif not utils.file_exists(path_to_create) then
local success = uv.fs_mkdir(path_to_create, 493)
local success = vim.loop.fs_mkdir(path_to_create, 493)
if not success then
notify.error("Could not create folder " .. path_to_create)
is_error = true