How to disable builtin plugins

I benchmarked my neovim’s startup time with nvim --startuptime vim.log. Unfortunately, it is much slower than it used to be a few months back when I last benchmarked it.

I noticed that some builtin plugins are taking a lot of time to load, and one of them is being sourced several times:

079.175  000.106  000.106: sourcing /tmp/.mount_nvim5C8SgD/usr/share/nvim/runtime/plugin/tohtml.vim
079.293  000.036  000.036: sourcing /tmp/.mount_nvim5C8SgD/usr/share/nvim/runtime/plugin/tutor.vim
079.534  000.204  000.204: sourcing /tmp/.mount_nvim5C8SgD/usr/share/nvim/runtime/plugin/zipPlugin.vim
136.101  000.194  000.194: sourcing /tmp/.mount_nvim5C8SgD/usr/share/nvim/runtime/syntax/syncolor.vim
138.009  000.198  000.198: sourcing /tmp/.mount_nvim5C8SgD/usr/share/nvim/runtime/syntax/syncolor.vim
139.750  000.179  000.179: sourcing /tmp/.mount_nvim5C8SgD/usr/share/nvim/runtime/syntax/syncolor.vim

How can I disable builtin plugins? For example, I don’t want to source tutor.vim or tohtml.vim since I don’t think I need them at all. I also want to make sure that syncolor.vim is sourced once.

I just noticed that syncolor.vim gets sourced by my colorscheme plugin, and apparently, that is taking a lot of time. But the original question still holds: suppose I don’t want to source tohtml.vim or tutor.vim. How can I do this?

Each plugin has a variable that it checks before loading the plugin. For example, for tutor variable name is g:loaded_tutor_mode_plugin (found from /usr/local/share/nvim/runtime/plugin/tutor.vim).
Just set these variables to 1 in your init.vim to prevent them to be loaded:

let g:loaded_tutor_mode_plugin = 1
1 Like

What does this line:

let g:loaded_tutor_mode_plugin = 1

… look like in Lua code?

vim.g.loaded_tutor_mode_plugin = 1

1 Like
 ​local​ builtin_plugs ​=​ { 
-- put every built-in plugin you wanna disable here
 ​  ​'​2html_plugin​'​, 
 ​  ​'​getscript​'​, 
 ​  ​'​getscriptPlugin​'​, 
 ​  ​'​gzip​'​, 
 ​} 
 ​for​ i ​=​ ​1​, ​#​builtin_plugs ​do 
 ​  g[​'​loaded_​'​ ​..​ builtin_plugs[i]] ​=​ ​true 
 ​end
4 Likes