Re: Which .vimrc
- c928400@... wrote:
>Right you are, this works.
> Thus wrote Zdenek Sekera (zs@...) on :
> > Just out of curiosity, how to do it and put <BAR> at the end of the
> > line?
> > The problem here is the 'echo' that will complain if done this way:
> > map ,gv :if !exists("current_gvimrc") <Bar><Bar> current_gvimrc == ""
> > <Bar>
> > \ echo "Cannot determine current" . '.vimrc' <Bar>
> > ^^^
> > \ else <BAR>
> > \ :exe "e " . expand(current_gvimrc) <Bar>
> > \ endif<CR>
> > What's the trick here?
> The problem for you in this case is that
> current_gvimrc == ""
> and everything there after appears to be seen as one expression.
> Grouping the conditions seems to do the trick:
> map ,gv :if (!exists("current_gvimrc") <Bar><Bar> current_gvimrc == "") <Bar>
> \ echo "Cannot determine current" . '.vimrc' <Bar>
> \else <Bar>
> \ :exe "e " . expand(current_gvimrc) <Bar>
However: syntax highlighting has a problem there: <Bar> I have
highlighted as a variable (that is the 'Bar' in <Bar> is highlighted as
Also, this executes differently from the case when <Bar>'s are at the
of the line: a) it needs <CR><CR> at the end to prevent 'Hit return' and
b) with <CR><CR> it uses temporarily one more command (not surprising)
the display moves up and down which is far less pleasant.
This difference is somewhat surprising to me, both statements should
identical after parsing, IMHO.
So why it doesn't behave the same way?