> Three related questions about statusline:
> 
> 1. The help for 'stl' states that the statusline will be evaluated with·
> each window (and buffer) set to the current window (and buffer).  So, is·
> it a bug in the following that the local settings of the current window·
> are mirrored in all statusline entries?  (Version info below¹)
> 
> " This isn't what I'm actually doing in my function
> " It's just a reduced test case
> fun! StatusLine()
>    let indent = '('.repeat('·', &l:sw).')'
>    let cole = &l:cole ? ' ['.&l:cole.']' : ''
>    return indent . cole 
> endf
> 
> let &stl = '%!StatusLine()'
That remark about the current window applies to %{} items. Currently,
when using %! this does not apply.  I don't think we can change this
without causing trouble.
You should change the 'statusline' so that it uses %{} items.
I'll add a remark to the help about this:
	When the option starts with "%!" then it is used as an expression,
	evaluated and the result is used as the option value.  Example: >
		:set statusline=%!MyStatusLine()
<	The result can contain %{} items that will be evaluated too.
	Note that the "%!" expression is evaluated in the context of the
	current window and buffer, while %{} items are evaluated in the
	context of the window that the statusline belongs to.
> 2. Is there a way to access the 'actual_curbuf' variable from within a·
> function called as part of 'stl'?
> 
> E.g.:
> se stl=%!StatusLine()
> fun! StatusLine()
>     " access actual_curbuf from here?
> endf
As above, use an %{} item instead.
> 3. Trying a non-function approach, should the following work (change the·
> highlighting for non-current statuslines)?
> 
> let &stl = '%<%f%{bufnr("")==actual_curbuf?"":"%#Error#"}blahblahblah'
I don't think so.
-- 
This sentence is not sure that it exists, but if it does, it will
certainly consider the possibility that other sentences exist.
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
 
No comments:
Post a Comment