junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
34.13k stars 1.93k forks source link

Does autocmd User works for lazy loaded plugins only? #1085

Closed ikalnytskyi closed 1 year ago

ikalnytskyi commented 3 years ago

There's a line in the docs that shows how to hook plugin loading events with autocommands

Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
autocmd! User goyo.vim echom 'Goyo is now loaded!'

Do I understand correctly that this only works for plugins with for or on options (i.e. lazy loaded plugins)? I can't make things to work with something like this

Plug 'junegunn/goyo.vim'
autocmd! User goyo.vim echom 'Goyo is now loaded!'

NVIM v0.5.0-dev+1186-g8665a96b9
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-pro
totypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_L
EVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neo
vim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az67-513

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info
raghur commented 3 years ago

It looks like it... and at least based on my config, it looks like it wasn't always so (can't tell)

I find that triggering the autocmd to set up plugin configuration is really useful/helpful - so I'm hoping if there was a way to do this always (for all plugins)?

ikalnytskyi commented 1 year ago

I moved away from vim-plug, I'm no longer interested in the answer.