vim reads an awful lot of config files during startup yes vim is clearly also not software minimalism 🙁

please only 1 config file, maximum 2 (1x system wide (global), 1x per user) always at the same path

hostnamectl; # tested on
Operating System: Debian GNU/Linux 13 (trixie) 
Kernel: Linux 6.12.74+deb13+1-amd64
Architecture: x86-64

# luckily there is a easy way to find in what file what option was set
:verbose set number?
number
   Last set from /etc/vim/vimrc line 70

System/global files (if present)

  • /etc/vimrc (could not be found)
  • /etc/vim/vimrc
    • refers to:
    • /etc/vim/vimrc.local (could not be found)
    • and
    • debian.vim
      • find / -iname debian.vim; # was found here
        /usr/share/vim/vim91/debian.vim
  • /usr/share/vim/vimrc (could not be found)

User files (checked in order)

  • ~/.vimrc
    • exists and has (in this user’s installation) the following content:
    • syntax on
      " activate system clipboard of gnome2 mate desktop
      set clipboard=unnamedplus
      let g:termdebug_wide=1
      set autoindent
  • ~/.vim/vimrc (could not be found)
  • ~/.gvimrc (for GUI Vim; loaded after ~/.vimrc) (could not be found)
  • ~/.vim/gvimrc

Project/working-directory files (loaded if ‘exrc’ is set; secure with ‘secure’ option)

  • .vimrc (in current directory)
  • .exrc (in current directory)

Modeline settings
– modelines inside edited files (if ‘modeline’ is on; scanned for a number of lines defined by ‘modelines’)

Runtime files and directories Vim also sources (not strict “config files” but affect behavior)

  • $VIM/vimrc (Vim runtime vimrc)
  • $VIMRUNTIME/vimrc
  • /etc/virc (platform-specific variants)
  • plugin/*.vim, ftplugin/*, after/* under $VIMRUNTIME and ~/.vim
  • ~/.vim/plugin/*.vim, ~/.vim/ftplugin/*, ~/.vim/after/*

Environment-variable and command-line influences

  • $MYVIMRC (path to the user vimrc file)
  • –cmd and -u command-line options (override or specify config to use)
  • Ex: vim -u NONE to skip user vimrc files

Minimal/alternate startup files

  • /etc/virc and /usr/share/vim/vimrc (system-specific)
  • When started as “vim -u {vimrc}” or “vim -u NONE” behavior changes as above.

Notes:

  • gVim GUI reads gvimrc files (~/.gvimrc and ~/.vim/gvimrc) after vimrc.
  • Locations of system/runtime files vary by distribution; $VIMRUNTIME and $MYVIMRC show exact paths inside your installation.

vim

vim; # start vim then type
:scriptnames
1: /etc/vim/vimrc
2: /usr/share/vim/vim91/debian.vim
3: /usr/share/vim/vim91/syntax/syntax.vim
4: /usr/share/vim/vim91/syntax/synload.vim
5: /usr/share/vim/vim91/syntax/syncolor.vim
6: /usr/share/vim/vim91/colors/lists/default.vim
7: /usr/share/vim/vim91/filetype.vim
8: /usr/share/vim/vim91/scripts.vim
9: /usr/share/vim/vim91/autoload/dist/script.vim
10: ~/.vimrc
11: /usr/share/vim/vim91/syntax/nosyntax.vim
12: ~/.vim/plugin/clang_complete.vim
13: /usr/share/vim/vim91/plugin/getscriptPlugin.vim
14: /usr/share/vim/vim91/plugin/gzip.vim
15: /usr/share/vim/vim91/plugin/logiPat.vim
16: /usr/share/vim/vim91/plugin/manpager.vim
17: /usr/share/vim/vim91/plugin/matchparen.vim
18: /usr/share/vim/vim91/plugin/netrwPlugin.vim
19: /usr/share/vim/vim91/pack/dist/opt/netrw/plugin/netrwPlugin.vim
20: /usr/share/vim/vim91/plugin/openPlugin.vim
21 A: /usr/share/vim/vim91/autoload/dist/vim9.vim
22: /usr/share/vim/vim91/plugin/rrhelper.vim
23: /usr/share/vim/vim91/plugin/spellfile.vim
24: /usr/share/vim/vim91/plugin/tarPlugin.vim
25: /usr/share/vim/vim91/plugin/tohtml.vim
26: /usr/share/vim/vim91/plugin/tutor.vim
27: /usr/share/vim/vim91/plugin/vimballPlugin.vim
28: /usr/share/vim/vim91/plugin/zipPlugin.vim

vimlog

vim -V9vimlog; # start vim like this and it will write a file ./vimlog

chdir(/etc/vim)
fchdir() to previous dir
sourcing "/etc/vim/vimrc"
chdir(/usr/share/vim/vim91)
fchdir() to previous dir
line 25: sourcing "/usr/share/vim/vim91/debian.vim"
finished sourcing /usr/share/vim/vim91/debian.vim
continuing in /etc/vim/vimrc
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 65: sourcing "/usr/share/vim/vim91/syntax/syntax.vim"
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 20: sourcing "/usr/share/vim/vim91/syntax/synload.vim"
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 22: sourcing "/usr/share/vim/vim91/syntax/syncolor.vim"
chdir(/usr/share/vim/vim91/colors/lists)
fchdir() to previous dir
line 57: sourcing "/usr/share/vim/vim91/colors/lists/default.vim"
finished sourcing /usr/share/vim/vim91/colors/lists/default.vim
continuing in /usr/share/vim/vim91/syntax/syncolor.vim
finished sourcing /usr/share/vim/vim91/syntax/syncolor.vim
continuing in /usr/share/vim/vim91/syntax/synload.vim
finished sourcing /usr/share/vim/vim91/syntax/synload.vim
continuing in /usr/share/vim/vim91/syntax/syntax.vim
chdir(/usr/share/vim/vim91)
fchdir() to previous dir
line 26: sourcing "/usr/share/vim/vim91/filetype.vim"
not found in 'runtimepath': "ftdetect/*.vim"
finished sourcing /usr/share/vim/vim91/filetype.vim
continuing in /usr/share/vim/vim91/syntax/syntax.vim
Executing FileType Autocommands for "*"
autocommand 0verbose exe "set syntax=" . expand("<amatch>")

Executing BufRead Autocommands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | runtime! scripts.vim | endif

chdir(/usr/share/vim/vim91)
fchdir() to previous dir
line 0: sourcing "/usr/share/vim/vim91/scripts.vim"
chdir(/usr/share/vim/vim91/autoload/dist)
fchdir() to previous dir
line 27: sourcing "/usr/share/vim/vim91/autoload/dist/script.vim"
finished sourcing /usr/share/vim/vim91/autoload/dist/script.vim
continuing in /usr/share/vim/vim91/scripts.vim
finished sourcing /usr/share/vim/vim91/scripts.vim
continuing in BufRead Autocommands for "*"
Executing BufRead Autocommands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat && (expand("<amatch>") =~# '\.conf$'^I|| getline(1) =~ '^#' || getline(2) =~ '^#'^I|| getline(3) =~ '^#' || getline(4) =~ '^#'^I|| getline(5) =~ '^#') | setf FALLBACK conf | endif

finished sourcing /usr/share/vim/vim91/syntax/syntax.vim
continuing in /etc/vim/vimrc
finished sourcing /etc/vim/vimrc
chdir(/home/user)
fchdir() to previous dir
sourcing "$HOME/.vimrc"
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 1: sourcing "/usr/share/vim/vim91/syntax/syntax.vim"
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 16: sourcing "/usr/share/vim/vim91/syntax/nosyntax.vim"
Executing BufEnter Autocommands for "*"
autocommand syn clear

autocommand if exists("b:current_syntax") | unlet b:current_syntax | endif

finished sourcing /usr/share/vim/vim91/syntax/nosyntax.vim
continuing in /usr/share/vim/vim91/syntax/syntax.vim
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 20: sourcing "/usr/share/vim/vim91/syntax/synload.vim"
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 22: sourcing "/usr/share/vim/vim91/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim91/syntax/syncolor.vim
continuing in /usr/share/vim/vim91/syntax/synload.vim
finished sourcing /usr/share/vim/vim91/syntax/synload.vim
continuing in /usr/share/vim/vim91/syntax/syntax.vim
Executing FileType Autocommands for "*"
autocommand 0verbose exe "set syntax=" . expand("<amatch>")

finished sourcing /usr/share/vim/vim91/syntax/syntax.vim
continuing in /home/user/.vimrc
finished sourcing $HOME/.vimrc
not found in 'packpath': "pack/*/start/*"
chdir(/home/user/.vim/plugin)
fchdir() to previous dir
sourcing "/home/user/.vim/plugin/clang_complete.vim"
finished sourcing /home/user/.vim/plugin/clang_complete.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/getscriptPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/getscriptPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/gzip.vim"
finished sourcing /usr/share/vim/vim91/plugin/gzip.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/logiPat.vim"
finished sourcing /usr/share/vim/vim91/plugin/logiPat.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/manpager.vim"
finished sourcing /usr/share/vim/vim91/plugin/manpager.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/matchparen.vim"
finished sourcing /usr/share/vim/vim91/plugin/matchparen.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/netrwPlugin.vim"
not found in 'packpath': "pack/*/start/netrw"
chdir(/usr/share/vim/vim91)
fchdir() to previous dir
chdir(/home/user/.vim)
fchdir() to previous dir
chdir(/var/lib/vim/addons)
fchdir() to previous dir
chdir(/etc/vim)
fchdir() to previous dir
chdir(/usr/share/vim/vimfiles)
fchdir() to previous dir
chdir(/usr/share/vim/vim91)
fchdir() to previous dir
chdir(/usr/share/vim/vim91/pack/dist/opt)
fchdir() to previous dir
chdir(/usr/share/vim/vim91/pack/dist/opt/netrw/plugin)
fchdir() to previous dir
line 7: sourcing "/usr/share/vim/vim91/pack/dist/opt/netrw/plugin/netrwPlugin.vim"
finished sourcing /usr/share/vim/vim91/pack/dist/opt/netrw/plugin/netrwPlugin.vim
continuing in /usr/share/vim/vim91/plugin/netrwPlugin.vim
finished sourcing /usr/share/vim/vim91/plugin/netrwPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/openPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/openPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/rrhelper.vim"
finished sourcing /usr/share/vim/vim91/plugin/rrhelper.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/spellfile.vim"
finished sourcing /usr/share/vim/vim91/plugin/spellfile.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/tarPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/tarPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/tohtml.vim"
finished sourcing /usr/share/vim/vim91/plugin/tohtml.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/tutor.vim"
finished sourcing /usr/share/vim/vim91/plugin/tutor.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/vimballPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/vimballPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/zipPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/zipPlugin.vim
not found in 'packpath': "pack/*/start/*"
not found in 'runtimepath': "plugin/**/*.vim"
Reading viminfo file "/home/user/.viminfo" info oldfiles
Executing BufWinEnter Autocommands for "*"
autocommand autocmd SafeState * ++once call s:Highlight_Matching_Pair()

Executing BufEnter Autocommands for "*"
autocommand sil call s:LocalBrowse(expand("<amatch>"))

Executing VimEnter Autocommands for "*"
autocommand sil call s:VimEnter(expand("<amatch>"))

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing SafeState Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim91/syntax/syncolor.vim

Writing viminfo file "/home/user/.viminfo"

Links:

https://linuxize.com/post/how-to-show-line-numbers-in-vim/

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin