Skip to content

Commit

Permalink
fix: handle errors when setting window options
Browse files Browse the repository at this point in the history
  • Loading branch information
b0o committed Feb 4, 2024
1 parent a075075 commit e3a1b3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/incline/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ M.win_set_local_options = function(win, opts)
else
arg = opt .. '=' .. val
end
vim.cmd('setlocal ' .. arg)
local ok, res = pcall(vim.cmd.setlocal, arg)
if not ok then
vim.notify_once(
string.format("Incline.nvim: Failed to set window option '%s' to '%s': %s", opt, val, res),
vim.log.levels.ERROR
)
end
end
end)
end
Expand Down

0 comments on commit e3a1b3c

Please sign in to comment.