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:
zbirenbaum 2022-01-03 15:50:00 -05:00 committed by siduck
parent 9d013a3529
commit 1e6f9a2e52
2 changed files with 11 additions and 10 deletions

View file

@ -22,6 +22,7 @@ M.close_buffer = function(force)
local function switch_buffer(windows, buf)
local cur_win = vim.fn.winnr()
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("buffer %d", buf))
end
@ -121,7 +122,7 @@ M.hide_statusline = function()
local hidden = require("core.utils").load_config().plugins.options.statusline.hidden
local shown = require("core.utils").load_config().plugins.options.statusline.shown
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
if vim.tbl_contains(shown, buftype) then