NTBBloodbath / doom-one.nvim

doom-emacs' doom-one Lua port for Neovim
MIT License
211 stars 32 forks source link

feat: use vim.F.if_nil for set config default value #34

Closed fitrh closed 1 year ago

fitrh commented 1 year ago

See https://github.com/NTBBloodbath/doom-one.nvim/issues/32#issuecomment-1315344450

For config with true as the default value, using or is not the right solution since false or true is true, which means even if the user sets the config to false, the config still run as true.

vim.F.if_nil under the hood compares its value to nil

function if_nil(a, b)
        if a == nil then
                return b
        end
        return a
end
NTBBloodbath commented 1 year ago

Hey thank you so much, very appreciated