E117: Unknown function: asyncrun#run from .vimrc, but call asyncrun#run works fine after vim starts
Closed this issue · 6 comments
When I have asyncrun#run
inside .vimrc, it throws an error when starting vim. But when I run the same function using :call asyncrun#run
after vim/nvim loads, it works fine... Here's the output:
Error detected while processing /Users/guestuser/.vimrc:
line 1461:
E117: Unknown function: asyncrun#run
Press ENTER or type command to continue
I am using vim-plug package manager, and other plugin's functions work well in .vimrc. This is the first plugin whose API is not detected in .vimrc.
Plug 'skywind3000/asyncrun.vim'
System info:
❯ neofetch
c.' guestuser@macos.local
,xNMM. ---------------------
.OMMMMo OS: macOS 13.0.1 22A400 arm64
lMM" Host: MacBookPro18,2
.;loddo:. .olloddol;. Kernel: 22.1.0
cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 1 hour, 58 mins
.KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 358 (brew)
XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.8.1
;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 2056x1329
:MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Quartz Compositor
kMMMMMMMMMMMMMMMMMMMMMMMMWd. WM Theme: Blue (Dark)
'XMMMMMMMMMMMMMMMMMMMMMMMMMMk Terminal: tmux
'XMMMMMMMMMMMMMMMMMMMMMMMMK. CPU: Apple M1 Max
kMMMMMMMMMMMMMMMMMMMMMMd GPU: Apple M1 Max
;KMMMMMMMWXXWMMMMMMMk. Memory: 11236MiB / 32768MiB
"cooc*" "*coo'"
Don't call :AsyncRun
or asyncrun#run
during loading.
@skywind3000 Is there a workaround? I call it after call plug#end()
of vim-plug. Also, why does calling a function during load time from .vimrc does not work for asyncrun.vim but does for other plugins??
add this:
runtime plugin/asyncrun.vim
after call plug#end()
@skywind3000 Now I multiple errors like this:
Error detected while processing function AsyncRun_Job_OnTimer:
line 11:
E716: Key not present in Dictionary: "once == 0"
sorry, you need call them after VimEnter
auto command:
au VimEnter * call asyncrun#run(...)
@skywind3000 Ok thanks!