[英]vim cannot open file when run from .vimrc, but can open fine when run from terminal
每当我尝试使用Vim打开任何文件时,我都会收到以下错误消息:
Error detected while processing /home/emma/.vimrc:
line 138:
E484: Can't open file '/home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim'
Press ENTER or type command to continue
但是奇怪的是,当我这样做时,文件实际上打开了:
vim ~/.opam/system/share/ocp-indent/vim/indent/ocaml.vim
因此,我验证了该文件确实存在,并且Vim能够显示代码。
当vim说
E484: Can't open file '/home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim'
它的字面意思是一个名为'/home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim'
的文件(不是/home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim
)。
换句话说,问题在于您在文件名周围添加了引号。
固定:
source /home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim
另外,您可以在此处使用~
:
source ~/.opam/system/share/ocp-indent/vim/indent/ocaml.vim
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.