0

The defaults that Neovim has are specified in src/nvim/options.lua. I'm trying to understand this source,

Let's take for example, something like backup

    {
      full_name='backup', abbreviation='bk',
      short_desc=N_("keep backup file after overwriting a file"),
      type='bool', scope={'global'},
      varname='p_bk',
      defaults={if_true=false}
    },

If I look at the defaults line, I can see basically ignore if_true= and always reason about the default,

defaults={if_true=false}

I can verify with nvim -u NONE -i NONE --clean that these are

defaults={false}

Why does if_true= exist, what does it do?

1 Answer 1

0

This is a minor implementation detail which is only of some interest to those who contribute to Neovim.

For some obscure reason, in Neovim the C source code for options structure is auto-generated by Lua script.

As some values may depend on C preprocessor evaluation the generator script may output such directives and initialization assignments with different values. Hence, the (optional) fields condition, if_true and if_false.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.