web-dev-qa-db-fra.com

Pourquoi Vim ne source-t-il pas mon .vimrc au démarrage?

Remarque: modifié pour fournir plus d'informations.

J'ai modifié mon ~/.vimrc de manière significative (bien que certaines de mes modifications initiales que j'ai apportées à l'ensemble du système /etc/vim/vimrc). Cela n'a probablement aucune importance car je suis vraiment le seul utilisateur de mon ordinateur portable, et certainement le seul à éditer dans Vim.

Quoi qu'il en soit, avec le package Vim-LaTeX, les fichiers s'ouvrent avec des plis automatiquement insérés dans les sections et sous-sections de .tex documents. C'est bien (et utile de temps en temps) tant que les plis sont tous ouverts quand je commence. Les deux lignes suivantes semblent accomplir ce que je veux lorsque le .vimrc est d'origine!

set foldmethod=syntax
autocmd Syntax tex normal zR

Ma solution de contournement frustrante a été de générer manuellement .vimrc lorsque j'ouvre un document pour commencer la modification (ou au moins en invoquant zR manuellement pour ouvrir tous les plis).


Ma question en cascade est:

Y a-t-il une variable d'environnement que je peux définir (dans mon .bash_profile, disons) qui indique à Vim de rechercher .vimrc dans mon répertoire personnel? Cela ne devrait-il pas être la valeur par défaut? Comment puis-je résoudre ce problème?


EDIT: Je n'ai pas pu résoudre ce problème. J'ai inclus la sortie détaillée de vim -V. Il semble que mon ~/.vimrc est en cours de recherche, mais peut-être que d'autres éléments le "remplacent" en mémoire?

chdir(/home/sammy)
fchdir() to previous dir
sourcing "/home/sammy/.vimrc"
Searching for "debian.vim" in "/home/sammy/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/debian.vim"
Searching for "/usr/share/vim/vimfiles/debian.vim"
Searching for "/usr/share/vim/vim74/debian.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 10: sourcing "/usr/share/vim/vim74/debian.vim"
finished sourcing /usr/share/vim/vim74/debian.vim
continuing in /home/sammy/.vimrc
Searching for "/usr/share/vim/vimfiles/after/debian.vim"
Searching for "/home/sammy/.vim/after/debian.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 20: sourcing "/usr/share/vim/vim74/syntax/syntax.vim"
Searching for "syntax/synload.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/syntax/synload.vim"
Searching for "/var/lib/vim/addons/syntax/synload.vim"
Searching for "/usr/share/vim/vimfiles/syntax/synload.vim"
Searching for "/usr/share/vim/vim74/syntax/synload.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 19: sourcing "/usr/share/vim/vim74/syntax/synload.vim"
Searching for "syntax/syncolor.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 21: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
continuing in /usr/share/vim/vim74/syntax/synload.vim
Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
Searching for "/home/sammy/.vim/after/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim74/syntax/synload.vim
continuing in /usr/share/vim/vim74/syntax/syntax.vim
Searching for "filetype.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/filetype.vim"
Searching for "/var/lib/vim/addons/filetype.vim"
Searching for "/usr/share/vim/vimfiles/filetype.vim"
Searching for "/usr/share/vim/vim74/filetype.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 25: sourcing "/usr/share/vim/vim74/filetype.vim"
Searching for "ftdetect/*.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/ftdetect/*.vim"
Searching for "/var/lib/vim/addons/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/ftdetect/*.vim"
Searching for "/usr/share/vim/vim74/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/after/ftdetect/*.vim"
Searching for "/var/lib/vim/addons/after/ftdetect/*.vim"
Searching for "/home/sammy/.vim/after/ftdetect/*.vim"
not found in 'runtimepath': "ftdetect/*.vim"
finished sourcing /usr/share/vim/vim74/filetype.vim
continuing in /usr/share/vim/vim74/syntax/syntax.vim
Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
Searching for "/var/lib/vim/addons/after/filetype.vim"
Searching for "/home/sammy/.vim/after/filetype.vim"
finished sourcing /usr/share/vim/vim74/syntax/syntax.vim
continuing in /home/sammy/.vimrc
Searching for "syntax/syncolor.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 25: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
continuing in /home/sammy/.vimrc
Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
Searching for "/home/sammy/.vim/after/syntax/syncolor.vim"
Searching for "filetype.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/filetype.vim"
Searching for "/var/lib/vim/addons/filetype.vim"
Searching for "/usr/share/vim/vimfiles/filetype.vim"
Searching for "/usr/share/vim/vim74/filetype.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 28: sourcing "/usr/share/vim/vim74/filetype.vim"
finished sourcing /usr/share/vim/vim74/filetype.vim
continuing in /home/sammy/.vimrc
Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
Searching for "/var/lib/vim/addons/after/filetype.vim"
Searching for "/home/sammy/.vim/after/filetype.vim"
Searching for "ftplugin.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/ftplugin.vim"
Searching for "/var/lib/vim/addons/ftplugin.vim"
Searching for "/usr/share/vim/vimfiles/ftplugin.vim"
Searching for "/usr/share/vim/vim74/ftplugin.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 28: sourcing "/usr/share/vim/vim74/ftplugin.vim"
finished sourcing /usr/share/vim/vim74/ftplugin.vim
continuing in /home/sammy/.vimrc
Searching for "/usr/share/vim/vimfiles/after/ftplugin.vim"
Searching for "/var/lib/vim/addons/after/ftplugin.vim"
Searching for "/home/sammy/.vim/after/ftplugin.vim"
Searching for "indent.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/indent.vim"
Searching for "/var/lib/vim/addons/indent.vim"
Searching for "/usr/share/vim/vimfiles/indent.vim"
Searching for "/usr/share/vim/vim74/indent.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 28: sourcing "/usr/share/vim/vim74/indent.vim"
finished sourcing /usr/share/vim/vim74/indent.vim
continuing in /home/sammy/.vimrc
Searching for "/usr/share/vim/vimfiles/after/indent.vim"
Searching for "/var/lib/vim/addons/after/indent.vim"
Searching for "/home/sammy/.vim/after/indent.vim"
finished sourcing /home/sammy/.vimrc
Searching for "plugin/**/*.vim" in "/home/sammy/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/sammy/.vim/after"
Searching for "/home/sammy/.vim/plugin/**/*.vim"
Searching for "/var/lib/vim/addons/plugin/**/*.vim"
chdir(/var/lib/vim/addons/plugin)
fchdir() to previous dir
sourcing "/var/lib/vim/addons/plugin/SyntaxFolds.vim"
finished sourcing /var/lib/vim/addons/plugin/SyntaxFolds.vim
chdir(/var/lib/vim/addons/plugin)
fchdir() to previous dir
sourcing "/var/lib/vim/addons/plugin/filebrowser.vim"
finished sourcing /var/lib/vim/addons/plugin/filebrowser.vim
chdir(/var/lib/vim/addons/plugin)
fchdir() to previous dir
sourcing "/var/lib/vim/addons/plugin/imaps.vim"
finished sourcing /var/lib/vim/addons/plugin/imaps.vim
chdir(/var/lib/vim/addons/plugin)
fchdir() to previous dir
sourcing "/var/lib/vim/addons/plugin/libList.vim"
finished sourcing /var/lib/vim/addons/plugin/libList.vim
chdir(/var/lib/vim/addons/plugin)
fchdir() to previous dir
sourcing "/var/lib/vim/addons/plugin/remoteOpen.vim"
finished sourcing /var/lib/vim/addons/plugin/remoteOpen.vim
Searching for "/usr/share/vim/vimfiles/plugin/**/*.vim"
Searching for "/usr/share/vim/vim74/plugin/**/*.vim"
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/getscriptPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/getscriptPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/gzip.vim"
finished sourcing /usr/share/vim/vim74/plugin/gzip.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/matchparen.vim"
finished sourcing /usr/share/vim/vim74/plugin/matchparen.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/netrwPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/netrwPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/rrhelper.vim"
finished sourcing /usr/share/vim/vim74/plugin/rrhelper.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/spellfile.vim"
finished sourcing /usr/share/vim/vim74/plugin/spellfile.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/tarPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/tarPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/tohtml.vim"
finished sourcing /usr/share/vim/vim74/plugin/tohtml.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/vimballPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/vimballPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/zipPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/zipPlugin.vim
Searching for "/usr/share/vim/vimfiles/after/plugin/**/*.vim"
Searching for "/var/lib/vim/addons/after/plugin/**/*.vim"
Searching for "/home/sammy/.vim/after/plugin/**/*.vim"
1
Sammy Black

Pour Unix/Linux, vim recherche $HOME/.vimrc, donc la première chose qui pourrait affecter cela est, bien sûr, la variable d'environnement $HOME. Est-ce défini sur votre système (il doit être /home/your_user_name.

Il n'y a aucun endroit que j'ai vu qui spécifie où ce fichier devrait être, donc la seule autre façon que je peux voir serait de commencer par -u option pour spécifier un autre .vimrc:

-u <vimrc>      Use <vimrc> instead of any .vimrc
-U <gvimrc>     Use <gvimrc> instead of any .gvimrc

Je suppose que vous pouvez essayer d'utiliser cela comme solution de contournement, mais il serait probablement préférable de résoudre le problème, si possible. Je n'ai jamais eu de cas où il n'a pas lu .vimrc.

1
Marty Fried