Loading ...
Sorry, an error occurred while loading the content.

Re: statusline and %!Func() its context, seems like bad behaviour to me

Expand Messages
  • ZyX
    ... %{} is useless for some complex statuslines: e.g. try to update the example (&stl part) to automatically delete items when window shrinks. Also note that
    Message 1 of 14 , May 19, 2013
    • 0 Attachment
      > IIRC, %!Function() didn't exist until tab pages were added to Vim; then
      > it was invented so that you could call one function to generate the
      > whole tab line (the text-style one, where you generate all tabs at one
      > go). Since there is only one tab line, it didn't need to be called again
      > for each window. The status line (one for each window) has already a lot
      > of predefined %x items, and %{} expressions need only be added for the
      > few non-predefined things which you might want to put into it.

      %{} is useless for some complex statuslines: e.g. try to update the example (&stl part) to automatically delete items when window shrinks. Also note that %!-based solution is more robust (even while being a hack): you don’t need to rely on launched autocommands which are not always launched (I remember before current solution was created we used some hacks for command window; hacks for setting &stl for all windows at vim startup and incompatibility with some plugins that do not allow autocommands nesting or even open their windows with eventignore set). Old vim-powerline used this approach: %{} and updating on autocommands. You can workaround some problems by interacting through mutable globals, but such globals are bad on their own, not to mention `:h 'stl'` does not define the order in which %{} items are evaluated.

      --
      --
      You received this message from the "vim_dev" 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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • ZyX
      ... Order is irrelevant. But another good example is that you don’t know for sure how many segments will be displayed: e.g. you want to list all modified,
      Message 2 of 14 , May 19, 2013
      • 0 Attachment
        > %{} is useless for some complex statuslines: e.g. try to update the example (&stl part) to automatically delete items when window shrinks. Also note that %!-based solution is more robust (even while being a hack): you don’t need to rely on launched autocommands which are not always launched (I remember before current solution was created we used some hacks for command window; hacks for setting &stl for all windows at vim startup and incompatibility with some plugins that do not allow autocommands nesting or even open their windows with eventignore set). Old vim-powerline used this approach: %{} and updating on autocommands. You can workaround some problems by interacting through mutable globals, but such globals are bad on their own, not to mention `:h 'stl'` does not define the order in which %{} items are evaluated.

        Order is irrelevant. But another good example is that you don’t know for sure how many segments will be displayed: e.g. you want to list all modified, but unsaved buffers in the statusline with different highlighting in between. With %! powerline is fine even with existing limitation to have 80 % items in statusline. %{}-based solution can easily exceed this limit with complex 'stl' highlighting, AFAIR there were complains about the issue for vim-powerline.

        --
        --
        You received this message from the "vim_dev" 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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.