I am trying to give vim a global spellfile and a project-specific spellfile. The project-specific file is ./en.utf-8.add
relative to the cwd. This works fine if the project directory has no spaces, but gives error E474: Invalid argument
when calling set spellfile+=
for a path with spaces. I tried escaping the path with fnameescape()
, but I still get the error. Surrounding the path in quotes does not give any error, but it doesn't seem to have any effect.
I know I can just put the basename of the spell file relative to cwd, but I want entries in spellfile
to be absolute. Mostly because I want to be able to programmatically find the index of the local spellfile
for [count]zg
and [count]zug
.
Edit: Add examples
set spellfile=/foo bar/en.utf-8.add -> E474: Invalid argument: spellfile=/foo
set spellfile=/foo\ bar/en.utf-8.add -> E474: Invalid argument: spellfile=/foo\ bar/en.utf-8.add
set spellfile=/foo\\ bar/en.utf-8.add -> E474: Invalid argument: spellfile=/foo\\
set spellfile=/foobar/en.utf-8.add -> Sets the spellfile to /foobar/en.utf-8.add as expected
Interestingly, it seems that with a single space, the whole path is accepted, but somehow still invalid. With 0 or 2 spaces, the input is chopped when the space is reached, which makes sense. So, I can correctly encode the space, but it's still invalid for a spellfile
?
:help :set-args
and:help option-backslash
:help-&
if this is happening programmatically.option-backslash
, a single backslash before each space should suffice. "To include white space in a string option value it has to be preceded with a backslash. To include a backslash you have to use two." If I want a space, I put a backslash before. I don't want a backslash in the result, so I don't put 2.