I have this oneliner in my vimrc
but it does not work :
if has("patch-7.4.710") | set listchars+=space:· else | set listchars+=trail:· | endif
VIM says :
E518: Unknown option: else
Can you help me ?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityYou need to put another |
before else
otherwise vim will think your command is set listchars+=space:· else
instead of two separate commands. That's why you got the error message: else
is an unknown option for the command set
.
The correct syntax is the following:
if has("patch-7.4.710") | set listchars+=space:· | else | set listchars+=trail:· | endif
|
, before or after the else
? Now, I now it's both :-D. Thanks a lot :) !
if has("patch-7.4.710")
, instruction 2 set listchars+=space:·
, instruction 3 else
, instruction 4 set listchars+=trail:·
and last instruction endif
. As the |
are used to separate instructions it is only logical to put one before else
and one after :)
;
to separate instructions . In C else
is not an instruction, otherwise there would be a ;
after it :)