cleanup: remove unnecessary option restore_win_options
This was only necessary to begin with because I was using `vim.wo` to
set window options. I mistakenly thought that would set the option as
window-local, but it did not. This was fixed in
6f8bf067c0. Now all the window options
should function as expected without the extra logic.
This commit is contained in:
parent
308fe70d6c
commit
9e036c6a48
5 changed files with 6 additions and 35 deletions
|
|
@ -171,28 +171,10 @@ end
|
|||
M.set_win_options = function()
|
||||
local winid = vim.api.nvim_get_current_win()
|
||||
for k, v in pairs(config.win_options) do
|
||||
if config.restore_win_options then
|
||||
local varname = "_oil_" .. k
|
||||
if not pcall(vim.api.nvim_win_get_var, winid, varname) then
|
||||
local prev_value = vim.wo[k]
|
||||
vim.api.nvim_win_set_var(winid, varname, prev_value)
|
||||
end
|
||||
end
|
||||
vim.api.nvim_set_option_value(k, v, { scope = "local", win = winid })
|
||||
end
|
||||
end
|
||||
|
||||
M.restore_win_options = function()
|
||||
local winid = vim.api.nvim_get_current_win()
|
||||
for k in pairs(config.win_options) do
|
||||
local varname = "_oil_" .. k
|
||||
local has_opt, opt = pcall(vim.api.nvim_win_get_var, winid, varname)
|
||||
if has_opt then
|
||||
vim.api.nvim_set_option_value(k, opt, { scope = "local", win = winid })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Get a list of visible oil buffers and a list of hidden oil buffers
|
||||
---@note
|
||||
--- If any buffers are modified, return values are nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue