mirror of
https://github.com/neovim/neovim.git
synced 2026-05-05 05:25:10 +00:00
vim-patch:9.1.1892: Not possible to know once Vim is done with sourcing vimrc (#36429)
Problem: A plugin does not know when startup scripts were already
triggered. This is useful to determine if a function is
called inside vimrc or after (like when sourcing 'plugin/'
files).
Solution: Add the v:vim_did_init variable (Evgeni Chasnovski)
closes: vim/vim#18668
294bce21ee
Nvim has two more steps between sourcing startup scripts and loading
plugins. Set this variable after these two steps.
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
This commit is contained in:
@@ -203,6 +203,7 @@ static struct vimvar {
|
||||
VV(VV_EXITING, "exiting", VAR_NUMBER, VV_RO),
|
||||
VV(VV_MAXCOL, "maxcol", VAR_NUMBER, VV_RO),
|
||||
VV(VV_STACKTRACE, "stacktrace", VAR_LIST, VV_RO),
|
||||
VV(VV_VIM_DID_INIT, "vim_did_init", VAR_NUMBER, VV_RO),
|
||||
// Neovim
|
||||
VV(VV_STDERR, "stderr", VAR_NUMBER, VV_RO),
|
||||
VV(VV_MSGPACK_TYPES, "msgpack_types", VAR_DICT, VV_RO),
|
||||
|
||||
@@ -123,6 +123,7 @@ typedef enum {
|
||||
VV_EXITING,
|
||||
VV_MAXCOL,
|
||||
VV_STACKTRACE,
|
||||
VV_VIM_DID_INIT,
|
||||
// Nvim
|
||||
VV_STDERR,
|
||||
VV_MSGPACK_TYPES,
|
||||
|
||||
@@ -466,6 +466,8 @@ int main(int argc, char **argv)
|
||||
syn_maybe_enable();
|
||||
}
|
||||
|
||||
set_vim_var_nr(VV_VIM_DID_INIT, 1);
|
||||
|
||||
// Read all the plugin files.
|
||||
load_plugins();
|
||||
|
||||
|
||||
@@ -901,6 +901,14 @@ M.vars = {
|
||||
Read-only.
|
||||
]=],
|
||||
},
|
||||
vim_did_init = {
|
||||
type = 'integer',
|
||||
desc = [=[
|
||||
0 during initialization, 1 after sourcing |vimrc| and just
|
||||
before |load-plugins|.
|
||||
Read-only.
|
||||
]=],
|
||||
},
|
||||
virtnum = {
|
||||
type = 'integer',
|
||||
desc = [=[
|
||||
|
||||
Reference in New Issue
Block a user