本文介绍了不读 ~/.vimrc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 vim 似乎没有读取的 ~/.vimrc 文件./etc/vimrc 中有一个文件,看起来它正在使用该文件.
I have a ~/.vimrc file that vim doesn't seem to be reading.There is a file at /etc/vimrc, and it looks like it is using that one.
我的理解是主目录中的那个应该覆盖这个,不是吗?
My understanding is that the one in the home directory should override this one, shouldn't it?
更新
cat vim_strace | grep .vimrc
stat64("/etc/vimrc", {st_mode=S_IFREG|0644, st_size=1438, ...}) = 0
open("/etc/vimrc", O_RDONLY|O_LARGEFILE) = 3
stat64("/etc/vimrc", {st_mode=S_IFREG|0644, st_size=1438, ...}) = 0
stat64("/root/.vimrc", {st_mode=S_IFREG|0644, st_size=35, ...}) = 0
open("/root/.vimrc", O_RDONLY|O_LARGEFILE) = 3
stat64("/root/.vimrc", {st_mode=S_IFREG|0644, st_size=35, ...}) = 0
推荐答案
如果您使用的是 linux 并且想知道 vim 是否在启动时访问您的 ~/.vimrc,您可以使用 strace 启动它:
if you're on linux and want to know if vim is accessing your ~/.vimrc on startup you can launch it with strace:
strace -o vim_strace vim
然后退出vim.打开 vim_strace 文件并在文件中搜索vimrc".你应该找到这样的一行
then quit vim.Open the vim_strace file and search for "vimrc" in the file. you should find a line like that
stat64("/home/youruser/.vimrc", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
这意味着至少 vim 可以看到该文件.
which mean that at least vim sees the file.
这篇关于不读 ~/.vimrc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!