.vimrc: getting E474: Invalid argument: listchars=tab: no matter what I do

时光总嘲笑我的痴心妄想 提交于 2021-02-09 11:42:52

问题


I am getting an error with vim when loading it with a custom .vimrc file.

Error:

E474: Invalid argument: listchars=tab:

I have tried many thing including putting these lines in my file:

scriptencoding utf-8  
set encoding=utf-8  
set fileencoding=utf-8  
set bomb  

So far with many hours of research I just can't find a fix, I know it is something to do with UTF-8 encoding but gain, I can't seem to find something helpful.

Here is my .vimrc file

scriptencoding utf-8
set encoding=utf-8
set fileencoding=utf-8
set bomb

echo "My vimrc Loaded"

set nocompatible              " be iMproved
filetype off                  " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()  

" let Vundle manage Vundle
" required!  
Bundle 'gmarik/vundle'

Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'

Bundle 'L9'
Bundle 'FuzzyFinder'

Bundle 'git://git.wincent.com/command-t.git'

Bundle 'nerdtree'
Bundle 'ctrlp.vim'
Bundle 'syntastic' 

color darkspectrum

set tabstop=4
set shiftwidth=4
set autoindent
"set smartindent
"set expandtab
set hlsearch
"set showcmd
set number

set list 
set listchars=tab:| 

autocmd VimEnter * NERDTree

let NERDTreeShowHidden=1

filetype plugin indent on     " required!  

Also, here is my locale in case you need it:

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"  
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

回答1:


You need to escape the characters:

set listchars=tab:\|\ 



回答2:


You need to provide two characters, say 'X' and 'Y', to listchars=tab:XY. Your code only provides one, the '|' character, but a second one is needed.

Here's the relevant excerpt from help listchars within vim that explains it:

      tab:xy        Two characters to be used to show a tab.  The first
                    char is used once.  The second char is repeated to
                    fill the space that the tab normally occupies.
                    "tab:>-" will show a tab that takes four spaces as
                    ">---".  When omitted, a tab is show as ^I.


来源:https://stackoverflow.com/questions/20962204/vimrc-getting-e474-invalid-argument-listchars-tab-no-matter-what-i-do

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!