0

New to vim. I'm on MacOS and every time I do vim something.txt, it gives me

Error detected while processing /Users/mycomputer/.vimrc:
line  128:
E471: Argument required
Press ENTER or type command to continue

Everything works fine after I press ENTER. What could be the issue?

This is around line 128 in .vimrc if this helps:

    if count(s:opam_available_tools,"ocp-indent") == 0
  source "/Users/anyaji/.opam/4.09.0/share/ocp-indent/vim/indent/ocaml.vim"
endif
2

:source should be without quotes:

:source "/Users/anyaji/.opam/4.09.0/share/ocp-indent/vim/indent/ocaml.vim"
E471: Argument required

:source /Users/anyaji/.opam/4.09.0/share/ocp-indent/vim/indent/ocaml.vim
E484: Can't open file /Users/anyaji/.opam/4.09.0/share/ocp-indent/vim/indent/ocaml.vim

This file doesn't exist on my system, but as you can see the "argument required" error message went away and got replaced by a more suitable one :-) VimScripts are just sequences of commands you can type in the : commandline, so this is usually an easy way to debug stuff.

Why do you get the "Argument required" error? VimScript has the somewhat unusual choice of " as the comment character, so the file path is seen as a comment, and the command Vim sees is just :source without argument.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.