mirror of
https://github.com/tpope/vim-sensible.git
synced 2025-11-08 11:03:47 -05:00
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>
This commit is contained in:
@@ -26,7 +26,7 @@ function! s:MaySet(option) abort
|
|||||||
silent verbose execute 'setglobal all' a:option . '?'
|
silent verbose execute 'setglobal all' a:option . '?'
|
||||||
redir END
|
redir END
|
||||||
endif
|
endif
|
||||||
return out !~# " \\~[\\/][^\n]*$"
|
return out !~# " \\(\\~[\\/][^\n]*\\|Lua\\)$"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if s:MaySet('backspace')
|
if s:MaySet('backspace')
|
||||||
|
|||||||
Reference in New Issue
Block a user