Vim Error: E474: Invalid argument: listchars=tab:»·,trail:·

前端 未结 4 1428
粉色の甜心
粉色の甜心 2020-12-30 18:40

Summary:

I am receiving the following error for having the below line in my .vimrc file

Error:

E474: Invali         


        
相关标签:
4条回答
  • 2020-12-30 18:56

    None of the other solutions worked for me.

    My listchars looks like this:

    listchars=eol:~,tab:>.,trail:~,extends:>,precedes:<,space:_
    

    The problem was that my Vim is too old for the space: parameter in listchars. As we can read in this post (I modified the quote to make it more readable):

    space: was added to listchars in v7.4.710 on 2015-04-21 by Bram. The stock Debian install of Vim doesn't offer space:.

    The removal of the trailing ,space:_ solves the problem.


    But wait! I want my vimrc to be portable

    Well, as 816-8055 suggests you might use if has() in your vimrc:

    if has("patch-7.4.710")
        listchars=eol:~,tab:>.,trail:~,extends:>,precedes:<,space:_
    else
        listchars=eol:~,tab:>.,trail:~,extends:>,precedes:<
    endif
    
    0 讨论(0)
  • 2020-12-30 19:11

    Just placing set encoding=utf8 anywhere in my _vimrc, but before set lcs=tab:>-,trail:·,nbsp:·,extends:>,precedes:< solved it

    0 讨论(0)
  • 2020-12-30 19:14

    Solution:

    Place the following lines at the top of the .vimrc the error mentions:

    .vimrc:

    scriptencoding utf-8
    set encoding=utf-8
    
    0 讨论(0)
  • 2020-12-30 19:14

    Not a real solution to your specific problem, but another (non-utf8-safe) way might be just to use ASCII chars, like this:

    set listchars=tab:>-,trail:.,precedes:<,extends:>
    

    If you have UTF-8 available, Justins solution is the better one of course.

    0 讨论(0)
提交回复
热议问题