wheeeee
wheeeee

Reputation: 1505

vim cannot open file when run from .vimrc, but can open fine when run from terminal

Whenever I try to open any file with Vim I get this error message:

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

But the strange thing is that when I do this, the file actually opens:

vim ~/.opam/system/share/ocp-indent/vim/indent/ocaml.vim

So I've verified that the file does exist and that Vim is capable of displaying the code.

Here are lines 120 to the end of my .vimrc: enter image description here

And here is the entirety of ~/.opam/system/share/ocp-indent/vim/indent/ocaml.vim: enter image description here

Upvotes: 6

Views: 6948

Answers (1)

melpomene
melpomene

Reputation: 85757

When vim says

E484: Can't open file '/home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim'

it literally means a file called,

'/home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim'

not

/home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim

In other words, the problem is the quotes you added around the filename.

Fix:

  source /home/emma/.opam/system/share/ocp-indent/vim/indent/ocaml.vim

Also, you could use ~ there:

  source ~/.opam/system/share/ocp-indent/vim/indent/ocaml.vim

Upvotes: 11

Related Questions