Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My .vimrc contains:

if $LANG =~ '\(UTF\|utf\)-\?8' || $LC_CTYPE =~ '\(UTF\|utf\)-\?8'
  set list listchars=tab:»·,trail:~,extends:>,precedes:<
endif

But there is some chars which is unicode, when I run vim under LC_CTYPE=zh_TW.Big5 environment, it will show

Error detected while processing /home/user/.vimrc:
  line   70:
E474: Invalid argument: listchars=tab:»·,trail:~,extends:>,precedes:<
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Add the following line to your vimrc, preferably near the beginning:

scriptencoding utf-8

That will tell vim to read the file as UTF8 even if you're on a non-UTF system. It will then transcode any characters from that into your current encoding. If the characters you're using in the listchars option exist the other encodings that you use you shouldn't even need to have the conditional around that.

share|improve this answer
    
This method works on vim, but, I found gvim still shows that error message. –  Daniel YC Lin Feb 25 '13 at 5:11
    
Do you have a .gvimrc file that also contains unicode characters? If so, adding the same line to that file should fix the problem there as well. That command only applies to the file in which it is found, so would need to be included in any vim configuration file where the character encoding is important. –  qqx Feb 25 '13 at 15:39
    
I found the problem caused by my gvimrc and fixed it. –  Daniel YC Lin Feb 27 '13 at 1:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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