Sorry if this is a noob question(I'm new to configuring vim) but I was wondering if it is possible to disable startup scripts manually during a Vim session. I am aware of the :scriptnames command which lists all the scripts/plugins that vim sources. I was wondering if it would be possible to, from this list, disable scripts and see how they change the behavior.

I am using the vimtex plugin for editing LaTeX files and am facing a bit of lag when I'm typing. I would like to disable some scripts that I feel are unnecessary to see if it improves performance. What would you recommend doing when you face performance issues ?

  • Spelling "tek" is a major crime. As Knuth originally pointed out, "TeX" is supposed to be said as in Greek language.
    – Matt
    Oct 19, 2020 at 7:48
  • 2
    @Matt crime is major hyperbole; perhaps « gaffe » or similar? Let’s assume best intentions here.
    – D. Ben Knoble
    Oct 19, 2020 at 12:02

1 Answer 1


You have a few options, though some depend on plugin-authors to follow best-practices.

  • vim --noplugin is kind of a nuclear option. You can combine with -Nu NONE or other -u options to get varying levels of "just my config" (though, if you put config files in ~/.vim/plugin/ like me, this will disable those too)
  • let g:loaded_<plugin> = 1: most plugin scripts (though not all pieces of all plugins) have an include guard that stops them from executing if a special variable is already set. Have a look at the first 5 lines of code of any file you want to disable to see if you can do this. (I do it to disable certain vim-distributed plugins in my vimrc, which is generally the best place to add this; you could also do it via --cmd).
  • Delete (or move) the offending file so it can't be found by vim—this will likely break things quickly, but it will cause the scripts not to get executed

Unfortunately, it's a lot harder to do this mid-session. In almost all cases, you need to do some work on vim-startup to avoid loading a file—plugin files are sourced on startup. Autoloaded files and many other things (e.g., colorscheme files, compiler files, ftplugin files) are sourced on-demand; some of them, you can move at any time to temporarily disable them. Others, like autoload, you can only "move-to-disable" if you haven't yet triggered a function from that file.

If you really want to muck about with files like this, I recommend giving :help startup a good long read.

In some cases, :debug can be a better fit for tracking down a bug.

In many cases, :help profile can help you find out where performance issues are.

  • Wow ! I had completely forgotten about this. Apologies for the incredibly delayed repsonse. I've found using :profile to be really helpful. Thanks.
    – First User
    Dec 7, 2020 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.