Reputation: 9633
I have gVim 8.0.69 installed on my Windows 10 system along with Cygwin. I'm using the same .vimrc for both to keep them in sync. Some settings don't apply to both, so I'm using some conditional expressions in my .vimrc to selectively apply settings:
if !(has("gui_running"))
if version >= 747
" line 199 is the next line
set listchars=eol:-|,tab:>_,trail:~,extends:>,precedes:<,space:_
else
set listchars=eol:-|,tab:>_,trail:~,extends:>,precedes:<,
endif
endif
gVim is reporting the following error when I start it:
Error detected while processing C:\Users\<user name>\.vimrc:
line 199:
E488: Trailing characters: ,tab:>_,trail:~,extends:>,precedes:<,space:_
The line number refers to the first set listchars
command.
Executing :echo !(has("gui_running"))
in the gVim window reports 0
, and :echo has("gui_running")
returns 1
, so I know the conditional is evaluating correctly after the program has started
Why is this line even being executed?
Upvotes: 0
Views: 165
Reputation: 6441
The problem doesn't come only from the |
character but it comes mainly from the number of characters entered to the string setting eol
.
From :help listchars
it says:
*lcs-eol*
eol:c Character to show at the end of each line. When
omitted, there is no extra character at the end
It means that eol
at most needs 1 single character but you gave it two : -
and |
.
If you still want to list eol
by |
you need to escape it so it will not be interpreted as a pipe.
The exact set
cmd would be in that case:
set listchars=eol:\|,tab:>_,trail:~,extends:>,precedes:<,space:_
Upvotes: 4
Reputation: 85907
I don't know for sure, but vim still has to scan the commands to find the corresponding else
or endif
.
You have a |
in there; |
is a command separator. You could have written
if ...
set foo=bar|endif
so vim has to look at the part after the pipe to see what command it is.
I think you need to escape the pipe with set listchars=eol:-\|,tab:>_,...
.
Upvotes: 3