From f4f7e294695abe7837af62b68564114de7abd0b4 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:35:55 -0600 Subject: refactor(defaults): always set options, even if value hasn't changed (#26595) Comparing against the old value before setting matched the original C implementation, but there is no reason to use this restriction. In particular, this inhibits using OptionSet to determine when the option was set. If users need to handle a case where the option _changed_, it is easy to do so in an OptionSet autocommand using v:option_new and v:option_old (and friends). --- runtime/lua/vim/_defaults.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 041a8cd669..2627cbcd0d 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -189,9 +189,7 @@ if tty then -- Wait until Nvim is finished starting to set the option to ensure the -- OptionSet event fires. if vim.v.vim_did_enter == 1 then - if vim.o[option] ~= value then - vim.o[option] = value - end + vim.o[option] = value else vim.api.nvim_create_autocmd('VimEnter', { once = true, -- cgit