Is there a command in the Vim editor to find the .vimrc
file location?
Just try doing the following:
:version
You will get an output which includes something like:
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
As noted by Herbert in comments, this is where vim
looks for vimrc
s, it doesn't mean they exist.
You can check the full path of your vimrc
with
:echo $MYVIMRC
If the output is empty, then your vim
doesn't use a user vimrc
(just create it if you wish).
对于nvim
使用:scriptnames
就像Randy Morris 评论中提出的那样
:version 没有列出/etc/vim但这是 vim 在我从 vim-gtk3 运行 vim82 的 ubuntu 盒子上拾取 gvimrc 和 vimrc 的地方
If the existing answers do not help, run :script
which will show you all the locations where VIM is loading files from. Probably, your source file is located somewhere in those directories. If you find a different source file, you may insert the following in it:
if filereadable("/my/directory/.vim/.vimrc")
source /my/directory/.vim/.vimrc
endif
And VIM will load your custom config file wherever it is.
Check it is working by looking for it in the output of :script
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.