Reputation: 37
So strange is that it's all right before, but after I added one line in the vimrc with Windows Notepad, the error occur! And it makes me crazy!
Here is ":set listchars" part of my vimrc:
set listchars=tab:>-,eol:$,space:·
encountering error:
E474: invalid argument: listchars=tab:>-,eol:$,space:<a1><a4>
Upvotes: 0
Views: 3243
Reputation: 172598
As you're using non-ASCII characters, you need to use :help :scriptencoding
to specify the encoding of your ~/.vimrc
.
You're also overriding the default 'encoding'
, which affects the representation of any text inside Vim, also any non-ASCII text already read in. Therefore, you first need to :set encoding
, and only then (with the correct internal representation set) can you specify the script's encoding:
set encoding=utf-8
scriptencoding utf-8
set listchars=...
Alternatively, you could also work around the vimrc encoding issues by encoding the non-ASCII characters in a (double-quoted) string (:help expr-quote
), and using :let &option
instead of :set
:
let &listchars = "tab:>-,eol:$,space:\u00B7"
Upvotes: 2
Reputation: 1813
It seems, that Vim is loading the file vimrc
with some encoding that is not UTF-8. I don't know which encoding is used.
To force Vim to interpret vimrc
as UTF-8, the following line is needed:
scriptencoding utf-8
All lines following this lines are then interpreted as UTF-8. All lines before that line are interpreted in whatever Vim determines.
If you set encoding
in your vimrc
, the line scriptencoding
must be after that line.
So in your case, you need:
set encoding=utf-8
scriptencoding utf-8
See :help :scriptencoding
for details.
Upvotes: 0