Skip to content

Commit

Permalink
Use vim.uv
Browse files Browse the repository at this point in the history
vim.loop is deprecated
  • Loading branch information
mimikun committed Feb 11, 2024
1 parent bbd1c19 commit e1bba26
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions dot_config/nvim/lua/core/global.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
-- thx: https://github.com/ayamir/nvimdots/blob/main/lua/core/global.lua

local global = {}
local os_name = vim.loop.os_uname().sysname
local total_memory = vim.loop.get_total_memory()
local uv = vim.uv and vim.uv or vim.loop

local os_name = uv.os_uname().sysname
local total_memory = uv.get_total_memory()
-- 4GB
local linux_human_rights_memory_size = 4294967296
-- 9GB
Expand Down
7 changes: 4 additions & 3 deletions dot_config/nvim/lua/core/human_rights.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local global = require("core.global")
local uv = vim.uv and vim.uv or vim.loop

local is_windows = global.is_windows
local is_mac = global.is_mac
Expand Down Expand Up @@ -35,12 +36,12 @@ end
---------
-- RAM --
---------
local total_memory = vim.loop.get_total_memory()
local total_memory = uv.get_total_memory()

---------
-- CPU --
---------
local cpu_info = vim.loop.cpu_info()
local cpu_info = uv.cpu_info()
local cpu_name = cpu_info[1].model
local cpu = find(HUMAN_RIGHTS.cpu, cpu_name)

Expand Down Expand Up @@ -69,7 +70,7 @@ end
-----------------
-- Parallelism --
-----------------
local available_parallelism = vim.loop.available_parallelism()
local available_parallelism = uv.available_parallelism()

local human_rights = {}

Expand Down
5 changes: 3 additions & 2 deletions dot_config/nvim/lua/core/lazyvim.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local global = require("core.global")
local iconsets = require("utils.icons")
local uv = vim.uv and vim.uv or vim.loop

---@type boolean
local is_windows = global.is_windows
Expand All @@ -11,7 +12,7 @@ local is_human_rights = global.is_human_rights
local concurrency_limit_check = function()
local limit
if is_human_rights then
limit = is_windows and (vim.loop.available_parallelism() * 2) or nil
limit = is_windows and (uv.available_parallelism() * 2) or nil
else
limit = 1
end
Expand Down Expand Up @@ -39,7 +40,7 @@ local Lazy = {}

function Lazy:load_lazy()
-- Lazy.nvimでのプラグイン管理
if not vim.loop.fs_stat(lazy_path) then
if not uv.fs_stat(lazy_path) then
vim.fn.system({
"git",
"clone",
Expand Down

0 comments on commit e1bba26

Please sign in to comment.