Reputation: 41
Here is the snapshot for:scriptname
1: /etc/vimrc
2: /usr/share/vim/vim72/syntax/syntax.vim
3: /usr/share/vim/vim72/syntax/synload.vim
4: /usr/share/vim/vim72/syntax/syncolor.vim
5: /usr/share/vim/vim72/filetype.vim
6: /usr/share/vim/vim72/ftplugin.vim
7: /home/xxxxx/.vimrc
8: /usr/share/vim/vim72/syntax/nosyntax.vim
9: /usr/share/vim/vim72/indent.vim
10: /usr/share/vim/vim72/colors/desert.vim
11: /usr/share/vim/vim72/indoff.vim
12: /usr/share/vim/vim72/ftplugof.vim
13: /usr/share/vim/vim72/plugin/filetype.vim
14: /usr/share/vim/vim72/plugin/getscriptPlugin.vim
15: /usr/share/vim/vim72/plugin/gzip.vim
16: /usr/share/vim/vim72/plugin/matchparen.vim
17: /usr/share/vim/vim72/plugin/netrwPlugin.vim
18: /usr/share/vim/vim72/plugin/rrhelper.vim
19: /usr/share/vim/vim72/plugin/spellfile.vim
20: /usr/share/vim/vim72/plugin/tarPlugin.vim
21: /usr/share/vim/vim72/plugin/tohtml.vim
22: /usr/share/vim/vim72/plugin/vimballPlugin.vim
23: /usr/share/vim/vim72/plugin/zipPlugin.vim
24: /usr/share/vim/vim72/syntax/cpp.vim
25: /usr/share/vim/vim72/syntax/c.vim
26: /home/xxxxx/.vim/after/syntax/cpp.vim
On 7, my vimrc is being sourced and after that couple of .vim files are being sourced.
How do I stop these default sourcing of .vim files?
Upvotes: 0
Views: 639
Reputation: 4640
Use The Noplugin Option when starting Vim
Please look at the help file, :help starting
. BTW, the :help initialization
section is a good read too.
The section on --noplugin
describes the resulting options behavior:
--noplugin Skip loading plugins. Resets the 'loadplugins' option.
Note that the |-u| argument may also disable loading plugins:
argument load: vimrc files plugins defaults.vim ~
(nothing) yes yes yes
-u NONE no no no
-u DEFAULTS no no yes
-u NORC no yes no
--noplugin yes no yes
Thus, Starting vim with this option will execute your vimrc, but not source plugins (though you will get defaults...):
vim --noplugin
As phd had indicated, your settings in your ~/.vimrc file are also responsible for the *.vim files being sourced as well (e.g. filetype settings, indentation, colorscheme).
When I execute the ex command (Vim 8.2 on Windows 10), :scriptname
, I get:
1: ~\_vimrc
2: C:\Program Files\Vim\vim82\vim82\filetype.vim
3: C:\Program Files\Vim\vim82\vim82\ftplugin.vim
4: C:\Program Files\Vim\vim82\vim82\indent.vim
5: C:\Program Files\Vim\vim82\vim82\syntax\syntax.vim
6: C:\Program Files\Vim\vim82\vim82\syntax\synload.vim
7: C:\Program Files\Vim\vim82\vim82\syntax\syncolor.vim
8: C:\Program Files\Vim\vim82\vim82\colors\murphy.vim
9: C:\Program Files\Vim\vim82\vim82\ftplugin\help.vim
10: C:\Program Files\Vim\vim82\vim82\syntax\help.vim
Press ENTER or type command to continue
Vim Verbose Logging Can Provide a Detailed Perspective on Plug-in Sourcing
When starting Vim, you can use the verbose option with the verbosefile set, you can view the initialization process in as detailed a manner as you would like.
the :help -V
entry:
-V[N] Verbose. Sets the 'verbose' option to [N] (default: 10).
Messages will be given for each file that is ":source"d and
for reading or writing a viminfo file. Can be used to find
out what is happening upon startup and exit.
Example:
vim -V8 foobar
I started my vim session with vim --noplugin -V6vim_logging6.txt
(here N can be 1 to 10 (10 being the most logging)). Also, I set the logging file, verbosefile, to "logging6.txt".
For our purposes of viewing the sourcing, I scrape the log file with this ex command to view just the sourcing:
:v/^line \d\+/d
I can then view the sequential sourcing only from the log file:
1 line 28: sourcing "/usr/local/share/vim/vim82/filetype.vim"
2 line 28: sourcing "/usr/local/share/vim/vim82/ftplugin.vim"
3 line 29: sourcing "/usr/local/share/vim/vim82/filetype.vim"
4 line 29: sourcing "/usr/local/share/vim/vim82/ftplugin.vim"
5 line 29: sourcing "/usr/local/share/vim/vim82/indent.vim"
6 line 30: sourcing "/usr/local/share/vim/vim82/syntax/syntax.vim"
7 line 19: sourcing "/usr/local/share/vim/vim82/syntax/synload.vim"
8 line 21: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
9 line 66: sourcing "/usr/local/share/vim/vim82/colors/murphy.vim"
10 line 7: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
11 line 8: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
12 line 10: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
13 line 119: sourcing "/home/pbacon/.vimrc.plug"
14 line 1: sourcing "/home/pbacon/.vim/autoload/plug.vim"
15 line 14: sourcing "/usr/local/share/vim/vim82/ftoff.vim"
16 line 83: sourcing "/usr/local/share/vim/vim82/filetype.vim"
17 line 83: sourcing "/usr/local/share/vim/vim82/ftplugin.vim"
18 line 83: sourcing "/usr/local/share/vim/vim82/indent.vim"
Upvotes: 1