Are functions faster than commands in Neovim?

dein uses functions instead of commands even for functions that are exposed to the user, which adds a little extra input when you're working on init.vim

. Is there a reason for this? Are functions faster than commands?

+3


source to share


1 answer


Since most custom commands call one (or more) custom functions, the performance is tiny for functions, but it doesn't matter at all .

The teams more than compensate for this by providing faster typing, allowing (customizable) completion, more discoverable, etc. All caveats about premature optimization (don't) apply here.




You are linking to the dein package manager. I'm guessing that interacting with it is only (mostly) needed at startup time by calling it in your ~/.vimrc

. By using (autoloading) functions, you don't need to :runtime plugin/dein.vim

define custom commands; just having dein in is 'runtimepath'

enough to call its functions.

It also avoids polluting the command namespace with commands that are rarely or rarely used interactively. Some plugin authors also have their own unique style. For a definite answer, you need to ask the author :-)

+4


source







All Articles