Closed jdhao closed 2 months ago
:h startup
(Just adding a directory to rtp
doesn't immediately source its contents; that is done by Nvim during the startup sequence, which means after init.lua
is processed. If you need them earlier, you'll have to explicitly runtime!
them.)
I thought that you can not call vim.cmd
and vim.fn
in vim?
Vim (not Nvim) behaves the same?
no applicable
How is this not applicable?
Because you'll get the exact same behavior (in Vim as well) if you use an equivalent minimal.vim
; it has nothing to do with Lua.
okay, thanks, I thought the cause is using lua functions to call vim script command and function.
Problem
When I add a plugin to the runtime path and try to call functions or run a command provided by this plugin, I see errors that indicate this is an unknown function or command.
Steps to reproduce
nvim -u mini.lua
:Expected behavior
I expect that running the command or calling the function should work with success, but actually it doesn't. I am seeing the following message:
However, if you then call the function (
:lua =vim.fn.Hello()
) or run the command (:lua =vim.cmd("Echo")
) on the nvim command line, both work fine without error.Neovim version (nvim -v)
NVIM v0.10.1 Build type: Release LuaJIT 2.1.1720049189
Vim (not Nvim) behaves the same?
no applicable
Operating system/version
macOS 13.6.6
Terminal name/version
wezterm
$TERM environment variable
xterm-256color
Installation
homebrew