g:actual_curwin undefined

閲覧: 33 回
最初の未読メッセージにスキップ

Lifepillar

未読、
2019/06/19 14:13:212019/06/19
To: 'Lifepillar' via vim_use
I want to use g:statusline_winid and g:actual_curwin to detect
whether the currently drawn status line is the active one.

With Vim 8.1.1517, I have tried the following code:

fun! BuildStatusLine()
return g:statusline_winid ==# g:actual_curwin
\ ? 'Active' : 'Inactive'
endf

set statusline=%!BuildStatusLine()

but I get E121: Undefined variable: g:actual_curwin.

My understanding is that the global variables should be defined
when a %! expression is evaluated. Is that correct? If so, what
am I doing wrong?

Thanks,
Life.

Lifepillar

未読、
2019/06/19 15:01:542019/06/19
To: vim...@googlegroups.com
On 19 Jun 2019, at 20:13, 'Lifepillar' via vim_use <vim...@googlegroups.com> wrote:

>
> I want to use g:statusline_winid and g:actual_curwin to detect
> whether the currently drawn status line is the active one.
>
> With Vim 8.1.1517, I have tried the following code:
>
> fun! BuildStatusLine()
> return g:statusline_winid ==# g:actual_curwin
> \ ? 'Active' : 'Inactive'
> endf
>
> set statusline=%!BuildStatusLine()
>
> but I get E121: Undefined variable: g:actual_curwin.

Never mind, I've got it: g:statusline_winid is evaluated in %! expressions, but
g:actual_curwin is evaluated in %{} context. It makes sense now.

Life.
全員に返信
投稿者に返信
転送
新着メール 0 件