fix errors thrown by neovim no longer allowing implicit conversions of nil to 0 in api function calls. See neovim/neovim#16745 for details on why this is now an error
This commit is contained in:
parent
9d013a3529
commit
1e6f9a2e52
@ -22,6 +22,7 @@ M.close_buffer = function(force)
|
|||||||
local function switch_buffer(windows, buf)
|
local function switch_buffer(windows, buf)
|
||||||
local cur_win = vim.fn.winnr()
|
local cur_win = vim.fn.winnr()
|
||||||
for _, winid in ipairs(windows) do
|
for _, winid in ipairs(windows) do
|
||||||
|
winid = tonumber(winid) or 0
|
||||||
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
|
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
|
||||||
vim.cmd(string.format("buffer %d", buf))
|
vim.cmd(string.format("buffer %d", buf))
|
||||||
end
|
end
|
||||||
@ -121,7 +122,7 @@ M.hide_statusline = function()
|
|||||||
local hidden = require("core.utils").load_config().plugins.options.statusline.hidden
|
local hidden = require("core.utils").load_config().plugins.options.statusline.hidden
|
||||||
local shown = require("core.utils").load_config().plugins.options.statusline.shown
|
local shown = require("core.utils").load_config().plugins.options.statusline.shown
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local buftype = api.nvim_buf_get_option("%", "ft")
|
local buftype = api.nvim_buf_get_option(0, "ft")
|
||||||
|
|
||||||
-- shown table from config has the highest priority
|
-- shown table from config has the highest priority
|
||||||
if vim.tbl_contains(shown, buftype) then
|
if vim.tbl_contains(shown, buftype) then
|
||||||
|
@ -88,7 +88,7 @@ components.active[1][2] = {
|
|||||||
return " " .. icon .. " " .. filename .. " "
|
return " " .. icon .. " " .. filename .. " "
|
||||||
end,
|
end,
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 70
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||||
end,
|
end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = colors.white,
|
fg = colors.white,
|
||||||
@ -105,7 +105,7 @@ components.active[1][3] = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 80
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hl = {
|
hl = {
|
||||||
@ -218,7 +218,7 @@ components.active[2][1] = {
|
|||||||
return ""
|
return ""
|
||||||
end,
|
end,
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 80
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
||||||
end,
|
end,
|
||||||
hl = { fg = colors.green },
|
hl = { fg = colors.green },
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ components.active[3][1] = {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 70
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||||
end,
|
end,
|
||||||
hl = { fg = colors.grey_fg2, bg = colors.statusline_bg },
|
hl = { fg = colors.grey_fg2, bg = colors.statusline_bg },
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ components.active[3][1] = {
|
|||||||
components.active[3][2] = {
|
components.active[3][2] = {
|
||||||
provider = "git_branch",
|
provider = "git_branch",
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 70
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||||
end,
|
end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = colors.grey_fg2,
|
fg = colors.grey_fg2,
|
||||||
@ -317,7 +317,7 @@ components.active[3][6] = {
|
|||||||
components.active[3][7] = {
|
components.active[3][7] = {
|
||||||
provider = statusline_style.left,
|
provider = statusline_style.left,
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 90
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||||
end,
|
end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = colors.grey,
|
fg = colors.grey,
|
||||||
@ -328,7 +328,7 @@ components.active[3][7] = {
|
|||||||
components.active[3][8] = {
|
components.active[3][8] = {
|
||||||
provider = statusline_style.left,
|
provider = statusline_style.left,
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 90
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||||
end,
|
end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = colors.green,
|
fg = colors.green,
|
||||||
@ -339,7 +339,7 @@ components.active[3][8] = {
|
|||||||
components.active[3][9] = {
|
components.active[3][9] = {
|
||||||
provider = statusline_style.position_icon,
|
provider = statusline_style.position_icon,
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 90
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||||
end,
|
end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = colors.black,
|
fg = colors.black,
|
||||||
@ -362,7 +362,7 @@ components.active[3][10] = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) > 90
|
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hl = {
|
hl = {
|
||||||
|
Loading…
Reference in New Issue
Block a user