In a new buffer, the expression &l:autoread evaluates to the value -1, indicating that the local option autoread has not yet been set with :setl autoread or :setl noautoread.

When I set the local option with :setl autoread, the expression evaluates to 1, when I unset it with :setl noautoread, it evaluates to 0. In either case, I won't be able to automatically have the global value for the option set with :set autoread.

So, is there a possibility to completely unset/delete the local option so that the expression &l:autoread will evaluate to -1 again?

  • What you describe seems odd. The normal value for the option is 0 or 1. Which version of vim are you using? Commented Jul 13, 2016 at 12:14
  • @Luc, I double checked the behaviour, echo &l:autoread print -1 after starting up gvim. echo v:version prints 704. Commented Jul 13, 2016 at 13:20
  • My mistake, I was testing &l:autochdir which is a global option. Commented Jul 13, 2016 at 14:17

2 Answers 2


You could directly set the local option to -1:

setl autoread
let &l:autoread=-1

At this point echo &l:autoread returns -1, and setl autoread? outputs --autoread, which is the exact same output of a new buffer, meaning that the global value is being used for that option:

                                                        *:setl* *:setlocal*
:setl[ocal] ...         Like ":set" but set only the value local to the
                        Without argument: Display local values for all local
                        options which are different from the default.
                        When displaying a specific local option, show the
                        local value.  For a global/local boolean option, when
                        the global value is being used, "--" is displayed
                        before the option name.
  • 1
    This doesn't delete or unset a local option, it set's the local option to be -1
    – CervEd
    Commented Jun 15, 2023 at 14:11

To remove a setlocal override option such that the global set is used instead, you can

:setlocal autoread<
  • :setlocal autoread& or some variant?
    – D. Ben Knoble
    Commented Jun 15, 2023 at 16:01
  • 3
    @D.BenKnoble Or simply :set autoread<. :h :set says: :se[t] {option}< For |global-local| options: Remove the local value of {option}, so that the global value will be used. To not mistake with :setlocal autoread< that'll also copy the global value (as with this answer) Commented Jun 15, 2023 at 16:56
  • @D.BenKnoble that actually changes it to the default vim option and not the global option. For example, if makeprg is set globally to make -k -j 4 and I use a compiler that does setlocal makeprg ..., then setlocal makeprg& will change to make and not make -k -j 4
    – CervEd
    Commented Jun 15, 2023 at 17:20
  • @LucHermitte thank you! That's what I was looking for!
    – CervEd
    Commented Jun 15, 2023 at 17:21

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.