2 Commits
v2.0 ... master

Author SHA1 Message Date
Victor Schneuwly
0ce2d843d6 Fix MaySet detection for Lua following Neovim update (#195)
With version v0.10.0 of Neovim, the `:verbose` output added
"(run Nvim with -V1 for more details)" to the previous message,
which was simply "Last set from Lua".
2024-06-08 12:27:52 -04:00
Übertreiber
3e878abfd6 Fix MaySet detection for Neovim init.lua users
Neovim users since version 0.5 can write their global configuration in
an ~/.config/nvim/init.lua file instead of ~/.config/nvim/init.vim.

Unfortunately, `:verbose` support for Lua is still lacking even in
Neovim 0.8: instead of reporting the file and line that last changed an
option, it will simply say "last set in Lua" if that change happened in
a Lua script.

The regex used in MaySet does not recognize this case and so MaySet
falsely assumes that all Lua config comes from the system and not from
the user.

I've gone for a somewhat hacky solution and simply added the alternative
`/ Lua$/` to the regex. This assumes that the system-wide vimrc file is
always written in VimScript – which is true to this day according to the
[Neovim documentation][1].

[1]: https://github.com/neovim/neovim/blob/ce0fddf5/runtime/doc/starting.txt#L468-L472

Co-authored-by: Nico Madysa <nico.madysa@cern.ch>
2023-03-29 09:31:54 -04:00

View File

@@ -26,7 +26,7 @@ function! s:MaySet(option) abort
silent verbose execute 'setglobal all' a:option . '?'
redir END
endif
return out !~# " \\~[\\/][^\n]*$"
return out !~# " \\(\\~[\\/]\\|Lua\\)[^\n]*$"
endfunction
if s:MaySet('backspace')