Please explain highlight groups User1 ... User9!!!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Please explain highlight groups User1 ... User9!!!

jrfranklin
Hello All,

I've been trying to master my statusline customizations, and I've hit a wall in the application of colors to the statusline.

The documentation suggests to use the User1 to User9 highlight groups. Quoting from ":h 'statusline'":

  >     * -   Set highlight group to User{N}, where {N} is taken from the
  >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
  >           The difference between User{N} and StatusLine  will be applied
  >           to StatusLineNC for the statusline of non-current windows.
  >           The number N must be between 1 and 9.  See |hl-User1..9|

This just seems cryptic to me.  When I define User1 with the ":highlight" command, I would expect Vim to automatically adjust my highlighting to indicate an inactive window (based on the statements above).  However, in Vim 7.4, the highlighting is the same for all windows. I use GVim 8 at work, and the colors appear to adjust, but I'm just not sure that I'm even using the feature correctly.

Should I expect automatic adjustment of my User1 color in the statusline (using the "%*1" format spec)?

I'm tremendously confused about this feature and would love nothing more than to feel once-again in control of my statusline!!!

Thanks to all!
Jason

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

Tony Mechelynck
On Wed, May 10, 2017 at 12:59 AM,  <[hidden email]> wrote:

> Hello All,
>
> I've been trying to master my statusline customizations, and I've hit a wall in the application of colors to the statusline.
>
> The documentation suggests to use the User1 to User9 highlight groups. Quoting from ":h 'statusline'":
>
>   >     * -   Set highlight group to User{N}, where {N} is taken from the
>   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
>   >           The difference between User{N} and StatusLine  will be applied
>   >           to StatusLineNC for the statusline of non-current windows.
>   >           The number N must be between 1 and 9.  See |hl-User1..9|
>
> This just seems cryptic to me.  When I define User1 with the ":highlight" command, I would expect Vim to automatically adjust my highlighting to indicate an inactive window (based on the statements above).  However, in Vim 7.4, the highlighting is the same for all windows. I use GVim 8 at work, and the colors appear to adjust, but I'm just not sure that I'm even using the feature correctly.
>
> Should I expect automatic adjustment of my User1 color in the statusline (using the "%*1" format spec)?
>
> I'm tremendously confused about this feature and would love nothing more than to feel once-again in control of my statusline!!!
>
> Thanks to all!
> Jason

Highlight groups (all of them) are indeed global. Using the :hi
command with no arguments displays them all — there are a lot of them.
You may change them depending on context by *carefully* setting
autocommands in your owncoded colorscheme. Here is an example from
mine, sorry if it may seem longish. The autocommands are at the end
but they use what comes above it. Notice the "uninstall" autocommand
at the bottom for when the user sets a different colorscheme.
(g:CSApprox_approximator_function is a Funcref defined by the CSApprox
plugin.)

" display the status line of the active window in a distinctive color:
" bold black on bright red in the GUI, white on green in the console
" (where the bg is never bright, and dark red is sometimes an ugly sort
" of reddish brown).
hi StatusLine   gui=NONE,bold   guibg=red           guifg=black
        \       cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
hi WildMenu     gui=NONE,bold   guibg=#00FF00       guifg=black
        \       cterm=NONE,bold ctermbg=black       ctermfg=white
" make the status line bold-reverse (but B&W) for inactive windows
hi StatusLineNC gui=reverse,bold
        \       cterm=NONE      ctermbg=black       ctermfg=lightgrey
" make the active status line colours alternate between two settings
" to give a visual notice of the CursorHold/CursorHoldI events
if ! exists("s:statuslineflag")
  let s:statuslineflag = 0
endif
"
" The following 'fancy footwork' is needed to have our CursorHold autocommand
" work smoothly with 256-color cterms handled by the 3rd-party
csapprox.vim plugin
if exists('g:CSApprox_approximator_function')
    let s:ctbg1 = g:CSApprox_approximator_function(0,   255, 0) " green
    let s:ctbg2 = g:CSApprox_approximator_function(255, 0,   0) " red
    let s:ctfg  = g:CSApprox_approximator_function(0,   0,   0) " black
else
    let s:ctbg1 = 'darkgreen'
    let s:ctbg2 = 'black'
    let s:ctfg  = 'white'
endif

function! ToggleStatusLine()
    if s:statuslineflag
        exe 'hi StatusLine'
          \     'cterm=NONE,bold ctermbg=' . s:ctbg1 'ctermfg=' . s:ctfg
          \     'gui=NONE,bold   guibg=#00FF00        guifg=black'
        exe 'hi WildMenu'
          \     'cterm=NONE,bold ctermbg=' . s:ctbg2 'ctermfg=' . s:ctfg
          \     'gui=NONE,bold   guibg=red            guifg=black'
    else
        exe 'hi StatusLine'
          \     'cterm=NONE,bold ctermbg=' . s:ctbg2 'ctermfg=' . s:ctfg
          \     'gui=NONE,bold   guibg=red            guifg=black'
        exe 'hi WildMenu'
          \     'cterm=NONE,bold ctermbg=' . s:ctbg1 'ctermfg=' . s:ctfg
          \     'gui=NONE,bold   guibg=#00FF00        guifg=black'
    endif
    let s:statuslineflag = ! s:statuslineflag
endfunction

exe "augroup" s:colors_name
    au! CursorHold,CursorHoldI * call ToggleStatusLine()
    au! ColorScheme *
        \ if g:colors_name != s:colors_name | exe "au!" s:colors_name | endif
augroup END

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

jrfranklin
On Tuesday, May 9, 2017 at 8:31:12 PM UTC-4, Tony Mechelynck wrote:

> On Wed, May 10, 2017 at 12:59 AM,  <[hidden email]> wrote:
> > Hello All,
> >
> > I've been trying to master my statusline customizations, and I've hit a wall in the application of colors to the statusline.
> >
> > The documentation suggests to use the User1 to User9 highlight groups. Quoting from ":h 'statusline'":
> >
> >   >     * -   Set highlight group to User{N}, where {N} is taken from the
> >   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
> >   >           The difference between User{N} and StatusLine  will be applied
> >   >           to StatusLineNC for the statusline of non-current windows.
> >   >           The number N must be between 1 and 9.  See |hl-User1..9|
> >
> > This just seems cryptic to me.  When I define User1 with the ":highlight" command, I would expect Vim to automatically adjust my highlighting to indicate an inactive window (based on the statements above).  However, in Vim 7.4, the highlighting is the same for all windows. I use GVim 8 at work, and the colors appear to adjust, but I'm just not sure that I'm even using the feature correctly.
> >
> > Should I expect automatic adjustment of my User1 color in the statusline (using the "%*1" format spec)?
> >
> > I'm tremendously confused about this feature and would love nothing more than to feel once-again in control of my statusline!!!
> >
> > Thanks to all!
> > Jason
>
> Highlight groups (all of them) are indeed global. Using the :hi
> command with no arguments displays them all — there are a lot of them.
> You may change them depending on context by *carefully* setting
> autocommands in your owncoded colorscheme. Here is an example from
> mine, sorry if it may seem longish. The autocommands are at the end
> but they use what comes above it. Notice the "uninstall" autocommand
> at the bottom for when the user sets a different colorscheme.
> (g:CSApprox_approximator_function is a Funcref defined by the CSApprox
> plugin.)
>
> " display the status line of the active window in a distinctive color:
> " bold black on bright red in the GUI, white on green in the console
> " (where the bg is never bright, and dark red is sometimes an ugly sort
> " of reddish brown).
> hi StatusLine   gui=NONE,bold   guibg=red           guifg=black
>         \       cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
> hi WildMenu     gui=NONE,bold   guibg=#00FF00       guifg=black
>         \       cterm=NONE,bold ctermbg=black       ctermfg=white
> " make the status line bold-reverse (but B&W) for inactive windows
> hi StatusLineNC gui=reverse,bold
>         \       cterm=NONE      ctermbg=black       ctermfg=lightgrey
> " make the active status line colours alternate between two settings
> " to give a visual notice of the CursorHold/CursorHoldI events
> if ! exists("s:statuslineflag")
>   let s:statuslineflag = 0
> endif
> "
> " The following 'fancy footwork' is needed to have our CursorHold autocommand
> " work smoothly with 256-color cterms handled by the 3rd-party
> csapprox.vim plugin
> if exists('g:CSApprox_approximator_function')
>     let s:ctbg1 = g:CSApprox_approximator_function(0,   255, 0) " green
>     let s:ctbg2 = g:CSApprox_approximator_function(255, 0,   0) " red
>     let s:ctfg  = g:CSApprox_approximator_function(0,   0,   0) " black
> else
>     let s:ctbg1 = 'darkgreen'
>     let s:ctbg2 = 'black'
>     let s:ctfg  = 'white'
> endif
>
> function! ToggleStatusLine()
>     if s:statuslineflag
>         exe 'hi StatusLine'
>           \     'cterm=NONE,bold ctermbg=' . s:ctbg1 'ctermfg=' . s:ctfg
>           \     'gui=NONE,bold   guibg=#00FF00        guifg=black'
>         exe 'hi WildMenu'
>           \     'cterm=NONE,bold ctermbg=' . s:ctbg2 'ctermfg=' . s:ctfg
>           \     'gui=NONE,bold   guibg=red            guifg=black'
>     else
>         exe 'hi StatusLine'
>           \     'cterm=NONE,bold ctermbg=' . s:ctbg2 'ctermfg=' . s:ctfg
>           \     'gui=NONE,bold   guibg=red            guifg=black'
>         exe 'hi WildMenu'
>           \     'cterm=NONE,bold ctermbg=' . s:ctbg1 'ctermfg=' . s:ctfg
>           \     'gui=NONE,bold   guibg=#00FF00        guifg=black'
>     endif
>     let s:statuslineflag = ! s:statuslineflag
> endfunction
>
> exe "augroup" s:colors_name
>     au! CursorHold,CursorHoldI * call ToggleStatusLine()
>     au! ColorScheme *
>         \ if g:colors_name != s:colors_name | exe "au!" s:colors_name | endif
> augroup END

Thanks a ton for the reply, Tony!

So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.

As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?

Thanks again for the reply, man!

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

Tony Mechelynck
On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
[...]
> Thanks a ton for the reply, Tony!
>
> So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
>
> As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
>
> Thanks again for the reply, man!

The status line for the current split-window is highlighted in the
StatusLine highlight group. Status lines for all other split-windows
(the inactive ones) are highlighted in the StatusLineNC highlight
group. In addition, when doing command-line completion, the currently
selected match is highlighted in the WildMenu highlight group. These
are used on the default status lines and if you don't specify special
highlighting they will be used in custom status lines too.

Anything that can be tested fom the context of a split-window can be
used to set a different highlight to part of the status line. The
colours themselves are global, but by using appropriate constructs in
your 'statusline' option you can build it with almost infinite
variety. if?then:else expressions can be used advantageously there to
put various text, and even various highlight groups, depending on
circumstances; and any highlight groups can be used: "User" groups by
using %1* to %9* and any other ones by using their name, e.g. (IIUC,
and including the option-backslashes to guard the double quotes)
%{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
scary Error highlight group at that point of the statusline for
windows displaying buffers where the 'binary' local option is set.

See
    :h 'statusline'
    :h option-backslash

P.S. Here's how I set my status line. Rather complicated but I like the result:

if has('statusline')
  set statusline=%<%f\
%h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
%-12.(%l,%c%V%)\ %P
endif

and here is how I set my text-style tab bar (even in gvim, using
'showtabline' set to 2 and e absent from 'guioptions') with fancy
colors (the principle is the same as for the status line but I use a
function to construct it in steps):

if has('windows') && exists('+tabline')
  function MyTabLine()
    let rv = ''
    let i = 1
    while i <= tabpagenr('$')
      let rv .= '%#Normal#'
      let icur = tabpagewinnr(i)
      let imax = tabpagewinnr(i, '$')
      let rv .= '%' . i . 'T'
      let rv .= i . '|' . icur . ':' . imax . ' '
        if i == tabpagenr()
        let rv .= '%#NonText#'
      else
        let rv .= '%#SpecialKey#'
      endif
      let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
      if buf == ""
        let buf = '[NoName]'
      endif
      let rv .= buf . ' '
      let i += 1
    endwhile
    let rv .= '%T%=%999X%#Error#X%#Normal#%X'
    return rv
  endfunction
  set tabline=%!MyTabLine()
  set showtabline=2
endif

Best regards,
Tony.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

jrfranklin
On Tuesday, May 9, 2017 at 11:35:47 PM UTC-4, Tony Mechelynck wrote:

> On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
> [...]
> > Thanks a ton for the reply, Tony!
> >
> > So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
> >
> > As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
> >
> > Thanks again for the reply, man!
>
> The status line for the current split-window is highlighted in the
> StatusLine highlight group. Status lines for all other split-windows
> (the inactive ones) are highlighted in the StatusLineNC highlight
> group. In addition, when doing command-line completion, the currently
> selected match is highlighted in the WildMenu highlight group. These
> are used on the default status lines and if you don't specify special
> highlighting they will be used in custom status lines too.
>
> Anything that can be tested fom the context of a split-window can be
> used to set a different highlight to part of the status line. The
> colours themselves are global, but by using appropriate constructs in
> your 'statusline' option you can build it with almost infinite
> variety. if?then:else expressions can be used advantageously there to
> put various text, and even various highlight groups, depending on
> circumstances; and any highlight groups can be used: "User" groups by
> using %1* to %9* and any other ones by using their name, e.g. (IIUC,
> and including the option-backslashes to guard the double quotes)
> %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> scary Error highlight group at that point of the statusline for
> windows displaying buffers where the 'binary' local option is set.
>
> See
>     :h 'statusline'
>     :h option-backslash
>
> P.S. Here's how I set my status line. Rather complicated but I like the result:
>
> if has('statusline')
>   set statusline=%<%f\
> %h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
> %-12.(%l,%c%V%)\ %P
> endif
>
> and here is how I set my text-style tab bar (even in gvim, using
> 'showtabline' set to 2 and e absent from 'guioptions') with fancy
> colors (the principle is the same as for the status line but I use a
> function to construct it in steps):
>
> if has('windows') && exists('+tabline')
>   function MyTabLine()
>     let rv = ''
>     let i = 1
>     while i <= tabpagenr('$')
>       let rv .= '%#Normal#'
>       let icur = tabpagewinnr(i)
>       let imax = tabpagewinnr(i, '$')
>       let rv .= '%' . i . 'T'
>       let rv .= i . '|' . icur . ':' . imax . ' '
>         if i == tabpagenr()
>         let rv .= '%#NonText#'
>       else
>         let rv .= '%#SpecialKey#'
>       endif
>       let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
>       if buf == ""
>         let buf = '[NoName]'
>       endif
>       let rv .= buf . ' '
>       let i += 1
>     endwhile
>     let rv .= '%T%=%999X%#Error#X%#Normal#%X'
>     return rv
>   endfunction
>   set tabline=%!MyTabLine()
>   set showtabline=2
> endif
>
> Best regards,
> Tony.
Tony,

Thanks again for your efforts.

The code you posted is broken, I'm afraid.  In particular, the following example

  > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the

does not work as you might expect. This has caused me much grief in the past couple of weeks of looking for a solution to my problem. It is not possible to nest highlight group items within expression items.  I certainly wish it were! That would solve ALL of my problems!

The definition of my statusline can be found here: https://github.com/lifecrisis/vim-vimrc/blob/master/vimrc#L434.

I want to emphasize that I think the documentation here is wrong. To quote again:

  >     * -   Set highlight group to User{N}, where {N} is taken from the
  >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
  >           The difference between User{N} and StatusLine  will be applied
  >           to StatusLineNC for the statusline of non-current windows.
  >           The number N must be between 1 and 9.  See |hl-User1..9|

This indicates clearly that there should be some kind of automatic behavior in relation to the User1...User9 highlight groups.  The whole "difference between" nonsense... what on Earth is that??? That clearly indicates that some kind of automatic action should be taken by Vim... LOL I'm about to pull my hair out! HAHA!

There MUST be an elegant and concise way to highlight the statusline that automatically "darkens" the statuslines in the inactive windows.

I'm lost for where to look...

Thanks again!
Jason

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

Tony Mechelynck
On Wed, May 10, 2017 at 6:09 AM,  <[hidden email]> wrote:

> On Tuesday, May 9, 2017 at 11:35:47 PM UTC-4, Tony Mechelynck wrote:
>> On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
>> [...]
>> > Thanks a ton for the reply, Tony!
>> >
>> > So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
>> >
>> > As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
>> >
>> > Thanks again for the reply, man!
>>
>> The status line for the current split-window is highlighted in the
>> StatusLine highlight group. Status lines for all other split-windows
>> (the inactive ones) are highlighted in the StatusLineNC highlight
>> group. In addition, when doing command-line completion, the currently
>> selected match is highlighted in the WildMenu highlight group. These
>> are used on the default status lines and if you don't specify special
>> highlighting they will be used in custom status lines too.
>>
>> Anything that can be tested fom the context of a split-window can be
>> used to set a different highlight to part of the status line. The
>> colours themselves are global, but by using appropriate constructs in
>> your 'statusline' option you can build it with almost infinite
>> variety. if?then:else expressions can be used advantageously there to
>> put various text, and even various highlight groups, depending on
>> circumstances; and any highlight groups can be used: "User" groups by
>> using %1* to %9* and any other ones by using their name, e.g. (IIUC,
>> and including the option-backslashes to guard the double quotes)
>> %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
>> scary Error highlight group at that point of the statusline for
>> windows displaying buffers where the 'binary' local option is set.
>>
>> See
>>     :h 'statusline'
>>     :h option-backslash
>>
>> P.S. Here's how I set my status line. Rather complicated but I like the result:
>>
>> if has('statusline')
>>   set statusline=%<%f\
>> %h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
>> %-12.(%l,%c%V%)\ %P
>> endif
>>
>> and here is how I set my text-style tab bar (even in gvim, using
>> 'showtabline' set to 2 and e absent from 'guioptions') with fancy
>> colors (the principle is the same as for the status line but I use a
>> function to construct it in steps):
>>
>> if has('windows') && exists('+tabline')
>>   function MyTabLine()
>>     let rv = ''
>>     let i = 1
>>     while i <= tabpagenr('$')
>>       let rv .= '%#Normal#'
>>       let icur = tabpagewinnr(i)
>>       let imax = tabpagewinnr(i, '$')
>>       let rv .= '%' . i . 'T'
>>       let rv .= i . '|' . icur . ':' . imax . ' '
>>         if i == tabpagenr()
>>         let rv .= '%#NonText#'
>>       else
>>         let rv .= '%#SpecialKey#'
>>       endif
>>       let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
>>       if buf == ""
>>         let buf = '[NoName]'
>>       endif
>>       let rv .= buf . ' '
>>       let i += 1
>>     endwhile
>>     let rv .= '%T%=%999X%#Error#X%#Normal#%X'
>>     return rv
>>   endfunction
>>   set tabline=%!MyTabLine()
>>   set showtabline=2
>> endif
>>
>> Best regards,
>> Tony.
>
> Tony,
>
> Thanks again for your efforts.
>
> The code you posted is broken, I'm afraid.  In particular, the following example
>
>   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
>
> does not work as you might expect. This has caused me much grief in the past couple of weeks of looking for a solution to my problem. It is not possible to nest highlight group items within expression items.  I certainly wish it were! That would solve ALL of my problems!
>
> The definition of my statusline can be found here: https://github.com/lifecrisis/vim-vimrc/blob/master/vimrc#L434.
>
> I want to emphasize that I think the documentation here is wrong. To quote again:
>
>   >     * -   Set highlight group to User{N}, where {N} is taken from the
>   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
>   >           The difference between User{N} and StatusLine  will be applied
>   >           to StatusLineNC for the statusline of non-current windows.
>   >           The number N must be between 1 and 9.  See |hl-User1..9|
>
> This indicates clearly that there should be some kind of automatic behavior in relation to the User1...User9 highlight groups.  The whole "difference between" nonsense... what on Earth is that??? That clearly indicates that some kind of automatic action should be taken by Vim... LOL I'm about to pull my hair out! HAHA!
>
> There MUST be an elegant and concise way to highlight the statusline that automatically "darkens" the statuslines in the inactive windows.
Yes, there is. Just don't set any highlight group in your statusline,
and set constrastive colours to the StatusLine and StatusLineNC
highlight groups. Normally this is best done in a colourscheme. If
these two groups are set to the same colours, Vim will add circumflex
accents ^^^^^^^ in the empty spaces of the current window's statusline
instead.

See
    :help hl-StatusLine
    :help hl-StatusLineNC
>
> I'm lost for where to look...
>
> Thanks again!
> Jason

Best regards,
Tony.

P.S. I'm attaching my own "almost-default" colorscheme. To use it,
drop it in one of the following directories (I'm listing them using
the Unix-like notation used in Vim; for Windows, use %VARIABLE%
instead of $VARIABLE and \ instead of / when working outside Vim):

$VIM/vimfiles/colors/                  (system-wide, for any OS)
$HOME/.vim/colors/                   (user-private, for Unix-like OSes
including Linux and Mac OS X)
$HOME/vimfiles/colors/              (user-private, for Windows)

...then use the ":colorscheme almost-default" command (without the
quotes), either by typing it manually to try it out, or in your vimrc
if you like it. It is meant for gvim, for a 24-bit-color console with
'termguicolors' set, or for an 88- or 216-color console with 't_Co'
set appropriately and the CSApprox plugin installed; but it will work
even in an 8-background, 16-foreground color terminal (and display
fewer colours there, of course).

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

almost-default.vim (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

jrfranklin
On Wednesday, May 10, 2017 at 9:37:41 AM UTC-4, Tony Mechelynck wrote:

> On Wed, May 10, 2017 at 6:09 AM,  <[hidden email]> wrote:
> > On Tuesday, May 9, 2017 at 11:35:47 PM UTC-4, Tony Mechelynck wrote:
> >> On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
> >> [...]
> >> > Thanks a ton for the reply, Tony!
> >> >
> >> > So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
> >> >
> >> > As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
> >> >
> >> > Thanks again for the reply, man!
> >>
> >> The status line for the current split-window is highlighted in the
> >> StatusLine highlight group. Status lines for all other split-windows
> >> (the inactive ones) are highlighted in the StatusLineNC highlight
> >> group. In addition, when doing command-line completion, the currently
> >> selected match is highlighted in the WildMenu highlight group. These
> >> are used on the default status lines and if you don't specify special
> >> highlighting they will be used in custom status lines too.
> >>
> >> Anything that can be tested fom the context of a split-window can be
> >> used to set a different highlight to part of the status line. The
> >> colours themselves are global, but by using appropriate constructs in
> >> your 'statusline' option you can build it with almost infinite
> >> variety. if?then:else expressions can be used advantageously there to
> >> put various text, and even various highlight groups, depending on
> >> circumstances; and any highlight groups can be used: "User" groups by
> >> using %1* to %9* and any other ones by using their name, e.g. (IIUC,
> >> and including the option-backslashes to guard the double quotes)
> >> %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> >> scary Error highlight group at that point of the statusline for
> >> windows displaying buffers where the 'binary' local option is set.
> >>
> >> See
> >>     :h 'statusline'
> >>     :h option-backslash
> >>
> >> P.S. Here's how I set my status line. Rather complicated but I like the result:
> >>
> >> if has('statusline')
> >>   set statusline=%<%f\
> >> %h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
> >> %-12.(%l,%c%V%)\ %P
> >> endif
> >>
> >> and here is how I set my text-style tab bar (even in gvim, using
> >> 'showtabline' set to 2 and e absent from 'guioptions') with fancy
> >> colors (the principle is the same as for the status line but I use a
> >> function to construct it in steps):
> >>
> >> if has('windows') && exists('+tabline')
> >>   function MyTabLine()
> >>     let rv = ''
> >>     let i = 1
> >>     while i <= tabpagenr('$')
> >>       let rv .= '%#Normal#'
> >>       let icur = tabpagewinnr(i)
> >>       let imax = tabpagewinnr(i, '$')
> >>       let rv .= '%' . i . 'T'
> >>       let rv .= i . '|' . icur . ':' . imax . ' '
> >>         if i == tabpagenr()
> >>         let rv .= '%#NonText#'
> >>       else
> >>         let rv .= '%#SpecialKey#'
> >>       endif
> >>       let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
> >>       if buf == ""
> >>         let buf = '[NoName]'
> >>       endif
> >>       let rv .= buf . ' '
> >>       let i += 1
> >>     endwhile
> >>     let rv .= '%T%=%999X%#Error#X%#Normal#%X'
> >>     return rv
> >>   endfunction
> >>   set tabline=%!MyTabLine()
> >>   set showtabline=2
> >> endif
> >>
> >> Best regards,
> >> Tony.
> >
> > Tony,
> >
> > Thanks again for your efforts.
> >
> > The code you posted is broken, I'm afraid.  In particular, the following example
> >
> >   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> >
> > does not work as you might expect. This has caused me much grief in the past couple of weeks of looking for a solution to my problem. It is not possible to nest highlight group items within expression items.  I certainly wish it were! That would solve ALL of my problems!
> >
> > The definition of my statusline can be found here: https://github.com/lifecrisis/vim-vimrc/blob/master/vimrc#L434.
> >
> > I want to emphasize that I think the documentation here is wrong. To quote again:
> >
> >   >     * -   Set highlight group to User{N}, where {N} is taken from the
> >   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
> >   >           The difference between User{N} and StatusLine  will be applied
> >   >           to StatusLineNC for the statusline of non-current windows.
> >   >           The number N must be between 1 and 9.  See |hl-User1..9|
> >
> > This indicates clearly that there should be some kind of automatic behavior in relation to the User1...User9 highlight groups.  The whole "difference between" nonsense... what on Earth is that??? That clearly indicates that some kind of automatic action should be taken by Vim... LOL I'm about to pull my hair out! HAHA!
> >
> > There MUST be an elegant and concise way to highlight the statusline that automatically "darkens" the statuslines in the inactive windows.
>
> Yes, there is. Just don't set any highlight group in your statusline,
> and set constrastive colours to the StatusLine and StatusLineNC
> highlight groups. Normally this is best done in a colourscheme. If
> these two groups are set to the same colours, Vim will add circumflex
> accents ^^^^^^^ in the empty spaces of the current window's statusline
> instead.
>
> See
>     :help hl-StatusLine
>     :help hl-StatusLineNC
> >
> > I'm lost for where to look...
> >
> > Thanks again!
> > Jason
>
> Best regards,
> Tony.
>
> P.S. I'm attaching my own "almost-default" colorscheme. To use it,
> drop it in one of the following directories (I'm listing them using
> the Unix-like notation used in Vim; for Windows, use %VARIABLE%
> instead of $VARIABLE and \ instead of / when working outside Vim):
>
> $VIM/vimfiles/colors/                  (system-wide, for any OS)
> $HOME/.vim/colors/                   (user-private, for Unix-like OSes
> including Linux and Mac OS X)
> $HOME/vimfiles/colors/              (user-private, for Windows)
>
> ...then use the ":colorscheme almost-default" command (without the
> quotes), either by typing it manually to try it out, or in your vimrc
> if you like it. It is meant for gvim, for a 24-bit-color console with
> 'termguicolors' set, or for an 88- or 216-color console with 't_Co'
> set appropriately and the CSApprox plugin installed; but it will work
> even in an 8-background, 16-foreground color terminal (and display
> fewer colours there, of course).
Hey Tony,

I understand the default behavior of the highlight groups StatusLine and StatusLineNC. That is not the issue.  The problem is that grouping items in the statusline by color is brittle because one cannot conditionally apply colors in the statusline and have an automatic darkening effect as you would expect.

In short, putting more than two colors in your statusline requires all kinds of special hacks to get the "darkening" effect to work. It is then not guaranteed to work, for example if some other script ever uses the 'eventignore' setting. This is painful if you just want an attractive statusline that works seamlessly.

  > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the

The conditional application of highlighting that you mentioned above is what I want, but it does not work.  The documentation here is incomplete or simply misleading (I can't tell which).

In any case, the help system doesn't really explain what User1 ... User9 do or what benefit they add beyond just defining your own highlight groups. No examples are even provided.

Someone has to know why these special highlight groups where defined.

Thanks,
Jason

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

jrfranklin
On Wednesday, May 10, 2017 at 10:01:36 AM UTC-4, [hidden email] wrote:

> On Wednesday, May 10, 2017 at 9:37:41 AM UTC-4, Tony Mechelynck wrote:
> > On Wed, May 10, 2017 at 6:09 AM,  <[hidden email]> wrote:
> > > On Tuesday, May 9, 2017 at 11:35:47 PM UTC-4, Tony Mechelynck wrote:
> > >> On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
> > >> [...]
> > >> > Thanks a ton for the reply, Tony!
> > >> >
> > >> > So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
> > >> >
> > >> > As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
> > >> >
> > >> > Thanks again for the reply, man!
> > >>
> > >> The status line for the current split-window is highlighted in the
> > >> StatusLine highlight group. Status lines for all other split-windows
> > >> (the inactive ones) are highlighted in the StatusLineNC highlight
> > >> group. In addition, when doing command-line completion, the currently
> > >> selected match is highlighted in the WildMenu highlight group. These
> > >> are used on the default status lines and if you don't specify special
> > >> highlighting they will be used in custom status lines too.
> > >>
> > >> Anything that can be tested fom the context of a split-window can be
> > >> used to set a different highlight to part of the status line. The
> > >> colours themselves are global, but by using appropriate constructs in
> > >> your 'statusline' option you can build it with almost infinite
> > >> variety. if?then:else expressions can be used advantageously there to
> > >> put various text, and even various highlight groups, depending on
> > >> circumstances; and any highlight groups can be used: "User" groups by
> > >> using %1* to %9* and any other ones by using their name, e.g. (IIUC,
> > >> and including the option-backslashes to guard the double quotes)
> > >> %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> > >> scary Error highlight group at that point of the statusline for
> > >> windows displaying buffers where the 'binary' local option is set.
> > >>
> > >> See
> > >>     :h 'statusline'
> > >>     :h option-backslash
> > >>
> > >> P.S. Here's how I set my status line. Rather complicated but I like the result:
> > >>
> > >> if has('statusline')
> > >>   set statusline=%<%f\
> > >> %h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
> > >> %-12.(%l,%c%V%)\ %P
> > >> endif
> > >>
> > >> and here is how I set my text-style tab bar (even in gvim, using
> > >> 'showtabline' set to 2 and e absent from 'guioptions') with fancy
> > >> colors (the principle is the same as for the status line but I use a
> > >> function to construct it in steps):
> > >>
> > >> if has('windows') && exists('+tabline')
> > >>   function MyTabLine()
> > >>     let rv = ''
> > >>     let i = 1
> > >>     while i <= tabpagenr('$')
> > >>       let rv .= '%#Normal#'
> > >>       let icur = tabpagewinnr(i)
> > >>       let imax = tabpagewinnr(i, '$')
> > >>       let rv .= '%' . i . 'T'
> > >>       let rv .= i . '|' . icur . ':' . imax . ' '
> > >>         if i == tabpagenr()
> > >>         let rv .= '%#NonText#'
> > >>       else
> > >>         let rv .= '%#SpecialKey#'
> > >>       endif
> > >>       let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
> > >>       if buf == ""
> > >>         let buf = '[NoName]'
> > >>       endif
> > >>       let rv .= buf . ' '
> > >>       let i += 1
> > >>     endwhile
> > >>     let rv .= '%T%=%999X%#Error#X%#Normal#%X'
> > >>     return rv
> > >>   endfunction
> > >>   set tabline=%!MyTabLine()
> > >>   set showtabline=2
> > >> endif
> > >>
> > >> Best regards,
> > >> Tony.
> > >
> > > Tony,
> > >
> > > Thanks again for your efforts.
> > >
> > > The code you posted is broken, I'm afraid.  In particular, the following example
> > >
> > >   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> > >
> > > does not work as you might expect. This has caused me much grief in the past couple of weeks of looking for a solution to my problem. It is not possible to nest highlight group items within expression items.  I certainly wish it were! That would solve ALL of my problems!
> > >
> > > The definition of my statusline can be found here: https://github.com/lifecrisis/vim-vimrc/blob/master/vimrc#L434.
> > >
> > > I want to emphasize that I think the documentation here is wrong. To quote again:
> > >
> > >   >     * -   Set highlight group to User{N}, where {N} is taken from the
> > >   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
> > >   >           The difference between User{N} and StatusLine  will be applied
> > >   >           to StatusLineNC for the statusline of non-current windows.
> > >   >           The number N must be between 1 and 9.  See |hl-User1..9|
> > >
> > > This indicates clearly that there should be some kind of automatic behavior in relation to the User1...User9 highlight groups.  The whole "difference between" nonsense... what on Earth is that??? That clearly indicates that some kind of automatic action should be taken by Vim... LOL I'm about to pull my hair out! HAHA!
> > >
> > > There MUST be an elegant and concise way to highlight the statusline that automatically "darkens" the statuslines in the inactive windows.
> >
> > Yes, there is. Just don't set any highlight group in your statusline,
> > and set constrastive colours to the StatusLine and StatusLineNC
> > highlight groups. Normally this is best done in a colourscheme. If
> > these two groups are set to the same colours, Vim will add circumflex
> > accents ^^^^^^^ in the empty spaces of the current window's statusline
> > instead.
> >
> > See
> >     :help hl-StatusLine
> >     :help hl-StatusLineNC
> > >
> > > I'm lost for where to look...
> > >
> > > Thanks again!
> > > Jason
> >
> > Best regards,
> > Tony.
> >
> > P.S. I'm attaching my own "almost-default" colorscheme. To use it,
> > drop it in one of the following directories (I'm listing them using
> > the Unix-like notation used in Vim; for Windows, use %VARIABLE%
> > instead of $VARIABLE and \ instead of / when working outside Vim):
> >
> > $VIM/vimfiles/colors/                  (system-wide, for any OS)
> > $HOME/.vim/colors/                   (user-private, for Unix-like OSes
> > including Linux and Mac OS X)
> > $HOME/vimfiles/colors/              (user-private, for Windows)
> >
> > ...then use the ":colorscheme almost-default" command (without the
> > quotes), either by typing it manually to try it out, or in your vimrc
> > if you like it. It is meant for gvim, for a 24-bit-color console with
> > 'termguicolors' set, or for an 88- or 216-color console with 't_Co'
> > set appropriately and the CSApprox plugin installed; but it will work
> > even in an 8-background, 16-foreground color terminal (and display
> > fewer colours there, of course).
>
> Hey Tony,
>
> I understand the default behavior of the highlight groups StatusLine and StatusLineNC. That is not the issue.  The problem is that grouping items in the statusline by color is brittle because one cannot conditionally apply colors in the statusline and have an automatic darkening effect as you would expect.
>
> In short, putting more than two colors in your statusline requires all kinds of special hacks to get the "darkening" effect to work. It is then not guaranteed to work, for example if some other script ever uses the 'eventignore' setting. This is painful if you just want an attractive statusline that works seamlessly.
>
>   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
>
> The conditional application of highlighting that you mentioned above is what I want, but it does not work.  The documentation here is incomplete or simply misleading (I can't tell which).
>
> In any case, the help system doesn't really explain what User1 ... User9 do or what benefit they add beyond just defining your own highlight groups. No examples are even provided.
>
> Someone has to know why these special highlight groups where defined.
>
> Thanks,
> Jason
I have raised a Github issue concerning this problem.  The issue is accessible at: https://github.com/vim/vim/issues/1697.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

Nikolay Aleksandrovich Pavlov
In reply to this post by jrfranklin
2017-05-10 17:01 GMT+03:00  <[hidden email]>:

> On Wednesday, May 10, 2017 at 9:37:41 AM UTC-4, Tony Mechelynck wrote:
>> On Wed, May 10, 2017 at 6:09 AM,  <[hidden email]> wrote:
>> > On Tuesday, May 9, 2017 at 11:35:47 PM UTC-4, Tony Mechelynck wrote:
>> >> On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
>> >> [...]
>> >> > Thanks a ton for the reply, Tony!
>> >> >
>> >> > So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
>> >> >
>> >> > As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
>> >> >
>> >> > Thanks again for the reply, man!
>> >>
>> >> The status line for the current split-window is highlighted in the
>> >> StatusLine highlight group. Status lines for all other split-windows
>> >> (the inactive ones) are highlighted in the StatusLineNC highlight
>> >> group. In addition, when doing command-line completion, the currently
>> >> selected match is highlighted in the WildMenu highlight group. These
>> >> are used on the default status lines and if you don't specify special
>> >> highlighting they will be used in custom status lines too.
>> >>
>> >> Anything that can be tested fom the context of a split-window can be
>> >> used to set a different highlight to part of the status line. The
>> >> colours themselves are global, but by using appropriate constructs in
>> >> your 'statusline' option you can build it with almost infinite
>> >> variety. if?then:else expressions can be used advantageously there to
>> >> put various text, and even various highlight groups, depending on
>> >> circumstances; and any highlight groups can be used: "User" groups by
>> >> using %1* to %9* and any other ones by using their name, e.g. (IIUC,
>> >> and including the option-backslashes to guard the double quotes)
>> >> %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
>> >> scary Error highlight group at that point of the statusline for
>> >> windows displaying buffers where the 'binary' local option is set.
>> >>
>> >> See
>> >>     :h 'statusline'
>> >>     :h option-backslash
>> >>
>> >> P.S. Here's how I set my status line. Rather complicated but I like the result:
>> >>
>> >> if has('statusline')
>> >>   set statusline=%<%f\
>> >> %h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
>> >> %-12.(%l,%c%V%)\ %P
>> >> endif
>> >>
>> >> and here is how I set my text-style tab bar (even in gvim, using
>> >> 'showtabline' set to 2 and e absent from 'guioptions') with fancy
>> >> colors (the principle is the same as for the status line but I use a
>> >> function to construct it in steps):
>> >>
>> >> if has('windows') && exists('+tabline')
>> >>   function MyTabLine()
>> >>     let rv = ''
>> >>     let i = 1
>> >>     while i <= tabpagenr('$')
>> >>       let rv .= '%#Normal#'
>> >>       let icur = tabpagewinnr(i)
>> >>       let imax = tabpagewinnr(i, '$')
>> >>       let rv .= '%' . i . 'T'
>> >>       let rv .= i . '|' . icur . ':' . imax . ' '
>> >>         if i == tabpagenr()
>> >>         let rv .= '%#NonText#'
>> >>       else
>> >>         let rv .= '%#SpecialKey#'
>> >>       endif
>> >>       let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
>> >>       if buf == ""
>> >>         let buf = '[NoName]'
>> >>       endif
>> >>       let rv .= buf . ' '
>> >>       let i += 1
>> >>     endwhile
>> >>     let rv .= '%T%=%999X%#Error#X%#Normal#%X'
>> >>     return rv
>> >>   endfunction
>> >>   set tabline=%!MyTabLine()
>> >>   set showtabline=2
>> >> endif
>> >>
>> >> Best regards,
>> >> Tony.
>> >
>> > Tony,
>> >
>> > Thanks again for your efforts.
>> >
>> > The code you posted is broken, I'm afraid.  In particular, the following example
>> >
>> >   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
>> >
>> > does not work as you might expect. This has caused me much grief in the past couple of weeks of looking for a solution to my problem. It is not possible to nest highlight group items within expression items.  I certainly wish it were! That would solve ALL of my problems!
>> >
>> > The definition of my statusline can be found here: https://github.com/lifecrisis/vim-vimrc/blob/master/vimrc#L434.
>> >
>> > I want to emphasize that I think the documentation here is wrong. To quote again:
>> >
>> >   >     * -   Set highlight group to User{N}, where {N} is taken from the
>> >   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
>> >   >           The difference between User{N} and StatusLine  will be applied
>> >   >           to StatusLineNC for the statusline of non-current windows.
>> >   >           The number N must be between 1 and 9.  See |hl-User1..9|
>> >
>> > This indicates clearly that there should be some kind of automatic behavior in relation to the User1...User9 highlight groups.  The whole "difference between" nonsense... what on Earth is that??? That clearly indicates that some kind of automatic action should be taken by Vim... LOL I'm about to pull my hair out! HAHA!
>> >
>> > There MUST be an elegant and concise way to highlight the statusline that automatically "darkens" the statuslines in the inactive windows.
>>
>> Yes, there is. Just don't set any highlight group in your statusline,
>> and set constrastive colours to the StatusLine and StatusLineNC
>> highlight groups. Normally this is best done in a colourscheme. If
>> these two groups are set to the same colours, Vim will add circumflex
>> accents ^^^^^^^ in the empty spaces of the current window's statusline
>> instead.
>>
>> See
>>     :help hl-StatusLine
>>     :help hl-StatusLineNC
>> >
>> > I'm lost for where to look...
>> >
>> > Thanks again!
>> > Jason
>>
>> Best regards,
>> Tony.
>>
>> P.S. I'm attaching my own "almost-default" colorscheme. To use it,
>> drop it in one of the following directories (I'm listing them using
>> the Unix-like notation used in Vim; for Windows, use %VARIABLE%
>> instead of $VARIABLE and \ instead of / when working outside Vim):
>>
>> $VIM/vimfiles/colors/                  (system-wide, for any OS)
>> $HOME/.vim/colors/                   (user-private, for Unix-like OSes
>> including Linux and Mac OS X)
>> $HOME/vimfiles/colors/              (user-private, for Windows)
>>
>> ...then use the ":colorscheme almost-default" command (without the
>> quotes), either by typing it manually to try it out, or in your vimrc
>> if you like it. It is meant for gvim, for a 24-bit-color console with
>> 'termguicolors' set, or for an 88- or 216-color console with 't_Co'
>> set appropriately and the CSApprox plugin installed; but it will work
>> even in an 8-background, 16-foreground color terminal (and display
>> fewer colours there, of course).
>
> Hey Tony,
>
> I understand the default behavior of the highlight groups StatusLine and StatusLineNC. That is not the issue.  The problem is that grouping items in the statusline by color is brittle because one cannot conditionally apply colors in the statusline and have an automatic darkening effect as you would expect.
>
> In short, putting more than two colors in your statusline requires all kinds of special hacks to get the "darkening" effect to work. It is then not guaranteed to work, for example if some other script ever uses the 'eventignore' setting. This is painful if you just want an attractive statusline that works seamlessly.
>
>   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
>
> The conditional application of highlighting that you mentioned above is what I want, but it does not work.  The documentation here is incomplete or simply misleading (I can't tell which).
>
> In any case, the help system doesn't really explain what User1 ... User9 do or what benefit they add beyond just defining your own highlight groups. No examples are even provided.
>
> Someone has to know why these special highlight groups where defined.

It looks like they could exist just to save few keystrokes, harming
readability in process. Or, more likely, some earlier Vim version
simply did not have `%#groupname#`, but had `%N*`.

>
> Thanks,
> Jason
>
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

jrfranklin
On Wednesday, May 10, 2017 at 12:07:03 PM UTC-4, ZyX wrote:

> 2017-05-10 17:01 GMT+03:00  <[hidden email]>:
> > On Wednesday, May 10, 2017 at 9:37:41 AM UTC-4, Tony Mechelynck wrote:
> >> On Wed, May 10, 2017 at 6:09 AM,  <[hidden email]> wrote:
> >> > On Tuesday, May 9, 2017 at 11:35:47 PM UTC-4, Tony Mechelynck wrote:
> >> >> On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
> >> >> [...]
> >> >> > Thanks a ton for the reply, Tony!
> >> >> >
> >> >> > So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
> >> >> >
> >> >> > As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
> >> >> >
> >> >> > Thanks again for the reply, man!
> >> >>
> >> >> The status line for the current split-window is highlighted in the
> >> >> StatusLine highlight group. Status lines for all other split-windows
> >> >> (the inactive ones) are highlighted in the StatusLineNC highlight
> >> >> group. In addition, when doing command-line completion, the currently
> >> >> selected match is highlighted in the WildMenu highlight group. These
> >> >> are used on the default status lines and if you don't specify special
> >> >> highlighting they will be used in custom status lines too.
> >> >>
> >> >> Anything that can be tested fom the context of a split-window can be
> >> >> used to set a different highlight to part of the status line. The
> >> >> colours themselves are global, but by using appropriate constructs in
> >> >> your 'statusline' option you can build it with almost infinite
> >> >> variety. if?then:else expressions can be used advantageously there to
> >> >> put various text, and even various highlight groups, depending on
> >> >> circumstances; and any highlight groups can be used: "User" groups by
> >> >> using %1* to %9* and any other ones by using their name, e.g. (IIUC,
> >> >> and including the option-backslashes to guard the double quotes)
> >> >> %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> >> >> scary Error highlight group at that point of the statusline for
> >> >> windows displaying buffers where the 'binary' local option is set.
> >> >>
> >> >> See
> >> >>     :h 'statusline'
> >> >>     :h option-backslash
> >> >>
> >> >> P.S. Here's how I set my status line. Rather complicated but I like the result:
> >> >>
> >> >> if has('statusline')
> >> >>   set statusline=%<%f\
> >> >> %h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
> >> >> %-12.(%l,%c%V%)\ %P
> >> >> endif
> >> >>
> >> >> and here is how I set my text-style tab bar (even in gvim, using
> >> >> 'showtabline' set to 2 and e absent from 'guioptions') with fancy
> >> >> colors (the principle is the same as for the status line but I use a
> >> >> function to construct it in steps):
> >> >>
> >> >> if has('windows') && exists('+tabline')
> >> >>   function MyTabLine()
> >> >>     let rv = ''
> >> >>     let i = 1
> >> >>     while i <= tabpagenr('$')
> >> >>       let rv .= '%#Normal#'
> >> >>       let icur = tabpagewinnr(i)
> >> >>       let imax = tabpagewinnr(i, '$')
> >> >>       let rv .= '%' . i . 'T'
> >> >>       let rv .= i . '|' . icur . ':' . imax . ' '
> >> >>         if i == tabpagenr()
> >> >>         let rv .= '%#NonText#'
> >> >>       else
> >> >>         let rv .= '%#SpecialKey#'
> >> >>       endif
> >> >>       let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
> >> >>       if buf == ""
> >> >>         let buf = '[NoName]'
> >> >>       endif
> >> >>       let rv .= buf . ' '
> >> >>       let i += 1
> >> >>     endwhile
> >> >>     let rv .= '%T%=%999X%#Error#X%#Normal#%X'
> >> >>     return rv
> >> >>   endfunction
> >> >>   set tabline=%!MyTabLine()
> >> >>   set showtabline=2
> >> >> endif
> >> >>
> >> >> Best regards,
> >> >> Tony.
> >> >
> >> > Tony,
> >> >
> >> > Thanks again for your efforts.
> >> >
> >> > The code you posted is broken, I'm afraid.  In particular, the following example
> >> >
> >> >   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> >> >
> >> > does not work as you might expect. This has caused me much grief in the past couple of weeks of looking for a solution to my problem. It is not possible to nest highlight group items within expression items.  I certainly wish it were! That would solve ALL of my problems!
> >> >
> >> > The definition of my statusline can be found here: https://github.com/lifecrisis/vim-vimrc/blob/master/vimrc#L434.
> >> >
> >> > I want to emphasize that I think the documentation here is wrong. To quote again:
> >> >
> >> >   >     * -   Set highlight group to User{N}, where {N} is taken from the
> >> >   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
> >> >   >           The difference between User{N} and StatusLine  will be applied
> >> >   >           to StatusLineNC for the statusline of non-current windows.
> >> >   >           The number N must be between 1 and 9.  See |hl-User1..9|
> >> >
> >> > This indicates clearly that there should be some kind of automatic behavior in relation to the User1...User9 highlight groups.  The whole "difference between" nonsense... what on Earth is that??? That clearly indicates that some kind of automatic action should be taken by Vim... LOL I'm about to pull my hair out! HAHA!
> >> >
> >> > There MUST be an elegant and concise way to highlight the statusline that automatically "darkens" the statuslines in the inactive windows.
> >>
> >> Yes, there is. Just don't set any highlight group in your statusline,
> >> and set constrastive colours to the StatusLine and StatusLineNC
> >> highlight groups. Normally this is best done in a colourscheme. If
> >> these two groups are set to the same colours, Vim will add circumflex
> >> accents ^^^^^^^ in the empty spaces of the current window's statusline
> >> instead.
> >>
> >> See
> >>     :help hl-StatusLine
> >>     :help hl-StatusLineNC
> >> >
> >> > I'm lost for where to look...
> >> >
> >> > Thanks again!
> >> > Jason
> >>
> >> Best regards,
> >> Tony.
> >>
> >> P.S. I'm attaching my own "almost-default" colorscheme. To use it,
> >> drop it in one of the following directories (I'm listing them using
> >> the Unix-like notation used in Vim; for Windows, use %VARIABLE%
> >> instead of $VARIABLE and \ instead of / when working outside Vim):
> >>
> >> $VIM/vimfiles/colors/                  (system-wide, for any OS)
> >> $HOME/.vim/colors/                   (user-private, for Unix-like OSes
> >> including Linux and Mac OS X)
> >> $HOME/vimfiles/colors/              (user-private, for Windows)
> >>
> >> ...then use the ":colorscheme almost-default" command (without the
> >> quotes), either by typing it manually to try it out, or in your vimrc
> >> if you like it. It is meant for gvim, for a 24-bit-color console with
> >> 'termguicolors' set, or for an 88- or 216-color console with 't_Co'
> >> set appropriately and the CSApprox plugin installed; but it will work
> >> even in an 8-background, 16-foreground color terminal (and display
> >> fewer colours there, of course).
> >
> > Hey Tony,
> >
> > I understand the default behavior of the highlight groups StatusLine and StatusLineNC. That is not the issue.  The problem is that grouping items in the statusline by color is brittle because one cannot conditionally apply colors in the statusline and have an automatic darkening effect as you would expect.
> >
> > In short, putting more than two colors in your statusline requires all kinds of special hacks to get the "darkening" effect to work. It is then not guaranteed to work, for example if some other script ever uses the 'eventignore' setting. This is painful if you just want an attractive statusline that works seamlessly.
> >
> >   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> >
> > The conditional application of highlighting that you mentioned above is what I want, but it does not work.  The documentation here is incomplete or simply misleading (I can't tell which).
> >
> > In any case, the help system doesn't really explain what User1 ... User9 do or what benefit they add beyond just defining your own highlight groups. No examples are even provided.
> >
> > Someone has to know why these special highlight groups where defined.
>
> It looks like they could exist just to save few keystrokes, harming
> readability in process. Or, more likely, some earlier Vim version
> simply did not have `%#groupname#`, but had `%N*`.
>
From the documentation in "version5.txt":

  'statusline' option: Configurable contents of the status line.  Also allows
  showing the byte offset in the file.  Highlighting with %1* to %9*, using the
  new highlight groups User1 to User9.  (Madsen)

These strange highlight groups were added in version 5.  

Also from the documentation:

  The 'statusline' option and other options that support the same format can now
  use these new features:
  - When it starts with "%!" the value is first evaluated as an expression
    before parsing the value.
  - "%#HLname#" can be used to start highlighting with HLname.

This was from version7.txt in the help files.

So, you are correct, Sir!

> >
> > Thanks,
> > Jason
> >
> > --
> > --
> > 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
> >
> > ---
> > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > For more options, visit https://groups.google.com/d/optout.
--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Please explain highlight groups User1 ... User9!!!

jrfranklin
On Wednesday, May 10, 2017 at 12:16:48 PM UTC-4, [hidden email] wrote:

> On Wednesday, May 10, 2017 at 12:07:03 PM UTC-4, ZyX wrote:
> > 2017-05-10 17:01 GMT+03:00  <[hidden email]>:
> > > On Wednesday, May 10, 2017 at 9:37:41 AM UTC-4, Tony Mechelynck wrote:
> > >> On Wed, May 10, 2017 at 6:09 AM,  <[hidden email]> wrote:
> > >> > On Tuesday, May 9, 2017 at 11:35:47 PM UTC-4, Tony Mechelynck wrote:
> > >> >> On Wed, May 10, 2017 at 3:04 AM,  <[hidden email]> wrote:
> > >> >> [...]
> > >> >> > Thanks a ton for the reply, Tony!
> > >> >> >
> > >> >> > So, just to confirm:  There is NO WAY to conveniently specify a pair of colors that the status line will use to alternate between to indicate active/inactive status? I find that hard to believe. This seems extremely odd to me if it's the case.  In fact, it would appear to be a deficiency within Vim itself.
> > >> >> >
> > >> >> > As another follow up question regarding the documentation: Note that it says "the difference ... will be applied".  This seems to indicate that vim should automatically "darken" inactive windows for me when I've defined and used User1 to highlight my statusline.  The documentation is then poorly written if this is not the behavior.  In fact, I have no idea what it means... Any thoughts?
> > >> >> >
> > >> >> > Thanks again for the reply, man!
> > >> >>
> > >> >> The status line for the current split-window is highlighted in the
> > >> >> StatusLine highlight group. Status lines for all other split-windows
> > >> >> (the inactive ones) are highlighted in the StatusLineNC highlight
> > >> >> group. In addition, when doing command-line completion, the currently
> > >> >> selected match is highlighted in the WildMenu highlight group. These
> > >> >> are used on the default status lines and if you don't specify special
> > >> >> highlighting they will be used in custom status lines too.
> > >> >>
> > >> >> Anything that can be tested fom the context of a split-window can be
> > >> >> used to set a different highlight to part of the status line. The
> > >> >> colours themselves are global, but by using appropriate constructs in
> > >> >> your 'statusline' option you can build it with almost infinite
> > >> >> variety. if?then:else expressions can be used advantageously there to
> > >> >> put various text, and even various highlight groups, depending on
> > >> >> circumstances; and any highlight groups can be used: "User" groups by
> > >> >> using %1* to %9* and any other ones by using their name, e.g. (IIUC,
> > >> >> and including the option-backslashes to guard the double quotes)
> > >> >> %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> > >> >> scary Error highlight group at that point of the statusline for
> > >> >> windows displaying buffers where the 'binary' local option is set.
> > >> >>
> > >> >> See
> > >> >>     :h 'statusline'
> > >> >>     :h option-backslash
> > >> >>
> > >> >> P.S. Here's how I set my status line. Rather complicated but I like the result:
> > >> >>
> > >> >> if has('statusline')
> > >> >>   set statusline=%<%f\
> > >> >> %h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
> > >> >> %-12.(%l,%c%V%)\ %P
> > >> >> endif
> > >> >>
> > >> >> and here is how I set my text-style tab bar (even in gvim, using
> > >> >> 'showtabline' set to 2 and e absent from 'guioptions') with fancy
> > >> >> colors (the principle is the same as for the status line but I use a
> > >> >> function to construct it in steps):
> > >> >>
> > >> >> if has('windows') && exists('+tabline')
> > >> >>   function MyTabLine()
> > >> >>     let rv = ''
> > >> >>     let i = 1
> > >> >>     while i <= tabpagenr('$')
> > >> >>       let rv .= '%#Normal#'
> > >> >>       let icur = tabpagewinnr(i)
> > >> >>       let imax = tabpagewinnr(i, '$')
> > >> >>       let rv .= '%' . i . 'T'
> > >> >>       let rv .= i . '|' . icur . ':' . imax . ' '
> > >> >>         if i == tabpagenr()
> > >> >>         let rv .= '%#NonText#'
> > >> >>       else
> > >> >>         let rv .= '%#SpecialKey#'
> > >> >>       endif
> > >> >>       let buf = fnamemodify(bufname(tabpagebuflist(i)[icur-1]),':t')
> > >> >>       if buf == ""
> > >> >>         let buf = '[NoName]'
> > >> >>       endif
> > >> >>       let rv .= buf . ' '
> > >> >>       let i += 1
> > >> >>     endwhile
> > >> >>     let rv .= '%T%=%999X%#Error#X%#Normal#%X'
> > >> >>     return rv
> > >> >>   endfunction
> > >> >>   set tabline=%!MyTabLine()
> > >> >>   set showtabline=2
> > >> >> endif
> > >> >>
> > >> >> Best regards,
> > >> >> Tony.
> > >> >
> > >> > Tony,
> > >> >
> > >> > Thanks again for your efforts.
> > >> >
> > >> > The code you posted is broken, I'm afraid.  In particular, the following example
> > >> >
> > >> >   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> > >> >
> > >> > does not work as you might expect. This has caused me much grief in the past couple of weeks of looking for a solution to my problem. It is not possible to nest highlight group items within expression items.  I certainly wish it were! That would solve ALL of my problems!
> > >> >
> > >> > The definition of my statusline can be found here: https://github.com/lifecrisis/vim-vimrc/blob/master/vimrc#L434.
> > >> >
> > >> > I want to emphasize that I think the documentation here is wrong. To quote again:
> > >> >
> > >> >   >     * -   Set highlight group to User{N}, where {N} is taken from the
> > >> >   >           minwid field, e.g. %1*.  Restore normal highlight with %* or %0*.
> > >> >   >           The difference between User{N} and StatusLine  will be applied
> > >> >   >           to StatusLineNC for the statusline of non-current windows.
> > >> >   >           The number N must be between 1 and 9.  See |hl-User1..9|
> > >> >
> > >> > This indicates clearly that there should be some kind of automatic behavior in relation to the User1...User9 highlight groups.  The whole "difference between" nonsense... what on Earth is that??? That clearly indicates that some kind of automatic action should be taken by Vim... LOL I'm about to pull my hair out! HAHA!
> > >> >
> > >> > There MUST be an elegant and concise way to highlight the statusline that automatically "darkens" the statuslines in the inactive windows.
> > >>
> > >> Yes, there is. Just don't set any highlight group in your statusline,
> > >> and set constrastive colours to the StatusLine and StatusLineNC
> > >> highlight groups. Normally this is best done in a colourscheme. If
> > >> these two groups are set to the same colours, Vim will add circumflex
> > >> accents ^^^^^^^ in the empty spaces of the current window's statusline
> > >> instead.
> > >>
> > >> See
> > >>     :help hl-StatusLine
> > >>     :help hl-StatusLineNC
> > >> >
> > >> > I'm lost for where to look...
> > >> >
> > >> > Thanks again!
> > >> > Jason
> > >>
> > >> Best regards,
> > >> Tony.
> > >>
> > >> P.S. I'm attaching my own "almost-default" colorscheme. To use it,
> > >> drop it in one of the following directories (I'm listing them using
> > >> the Unix-like notation used in Vim; for Windows, use %VARIABLE%
> > >> instead of $VARIABLE and \ instead of / when working outside Vim):
> > >>
> > >> $VIM/vimfiles/colors/                  (system-wide, for any OS)
> > >> $HOME/.vim/colors/                   (user-private, for Unix-like OSes
> > >> including Linux and Mac OS X)
> > >> $HOME/vimfiles/colors/              (user-private, for Windows)
> > >>
> > >> ...then use the ":colorscheme almost-default" command (without the
> > >> quotes), either by typing it manually to try it out, or in your vimrc
> > >> if you like it. It is meant for gvim, for a 24-bit-color console with
> > >> 'termguicolors' set, or for an 88- or 216-color console with 't_Co'
> > >> set appropriately and the CSApprox plugin installed; but it will work
> > >> even in an 8-background, 16-foreground color terminal (and display
> > >> fewer colours there, of course).
> > >
> > > Hey Tony,
> > >
> > > I understand the default behavior of the highlight groups StatusLine and StatusLineNC. That is not the issue.  The problem is that grouping items in the statusline by color is brittle because one cannot conditionally apply colors in the statusline and have an automatic darkening effect as you would expect.
> > >
> > > In short, putting more than two colors in your statusline requires all kinds of special hacks to get the "darkening" effect to work. It is then not guaranteed to work, for example if some other script ever uses the 'eventignore' setting. This is painful if you just want an attractive statusline that works seamlessly.
> > >
> > >   > %{&binary?\"%#Error#BINARY%0*\":\"\"} to output the text BINARY in the
> > >
> > > The conditional application of highlighting that you mentioned above is what I want, but it does not work.  The documentation here is incomplete or simply misleading (I can't tell which).
> > >
> > > In any case, the help system doesn't really explain what User1 ... User9 do or what benefit they add beyond just defining your own highlight groups. No examples are even provided.
> > >
> > > Someone has to know why these special highlight groups where defined.
> >
> > It looks like they could exist just to save few keystrokes, harming
> > readability in process. Or, more likely, some earlier Vim version
> > simply did not have `%#groupname#`, but had `%N*`.
> >
>
> From the documentation in "version5.txt":
>
>   'statusline' option: Configurable contents of the status line.  Also allows
>   showing the byte offset in the file.  Highlighting with %1* to %9*, using the
>   new highlight groups User1 to User9.  (Madsen)
>
> These strange highlight groups were added in version 5.  
>
> Also from the documentation:
>
>   The 'statusline' option and other options that support the same format can now
>   use these new features:
>   - When it starts with "%!" the value is first evaluated as an expression
>     before parsing the value.
>   - "%#HLname#" can be used to start highlighting with HLname.
>
> This was from version7.txt in the help files.
>
> So, you are correct, Sir!
>
> > >
> > > Thanks,
> > > Jason
> > >
> > > --
> > > --
> > > 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
> > >
> > > ---
> > > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > > For more options, visit https://groups.google.com/d/optout.

I believe it is still important that this be resolved, however.  The documentation is quite unclear.

If conditional application of highlighting in the status line is not directly possible, it might should be added.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.