On Thursday, May 18, 2017 at 11:54:11 AM UTC-5, Jack Nagel wrote: > I ran into what seems like a bug when setting the global value of a > buffer-local option from my .vimrc. > > If I invoke vim this way. > vim -N -i NONE -u NONE -c "setglobal autoindent" -- file > > > I would expect the buffer for file to have autoindent set, but :set > autoindent? returns noautoindent. > > However, if I invoke vim without a file argument, > vim -N -i NONE -u NONE -c "setglobal autoindent" > > > and instead open it using :e file, then :set autoindent? returns autoindent, > as expected. >
Per the help, "-c" runs a command "after the first file has been read (and after autocommands and modelines for that file have been processed)." So you cannot affect the first file using -c. However, Vim also provides the "--cmd" argument, which "will be executed before processing any vimrc file." Try using that instead, it seems to work for me. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
