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

Re: How to set USERNAME in RHS of "set" command

Expand Messages
  • John Little
    ... Perhaps I should have given all the details, the way Tony M does. My statusline is set to %
    Message 1 of 8 , Jul 2, 2012
    • 0 Attachment
      On Tuesday, July 3, 2012 7:34:55 AM UTC+12, Bee wrote:

      > Is it possible to make it a one liner?

      Perhaps I should have given all the details, the way Tony M does.

      My 'statusline' is set to

      %<%f%1*%{&ff=~'u'?'':&ff}%* %h%m%r%=%-16.(%l,%2c %L%) %P

      so I've got the usual stuff, with the dos or mac warning sitting right by the file name. My colour scheme has, amongst others,

      hi Normal guifg=white guibg=black
      hi StatusLine guifg=green guibg=DarkSlateGrey gui=underline,bold
      hi StatusLineNC guifg=darkgreen gui=underline,italic

      So the status line for the current window has a grey background, quite different from the black of the file I'm editing. The ff bit is coloured with highlight group User1, which I don't usually bother to define, so it comes out as Normal, white on black, not bold green underline on grey, quite distinct.

      Now the bit in the %{ ... } is a vim expression, not a status line specifier, so status line specifiers won't work in it. However, if the %{ ... } has zero length, you don't see it, so just include both of them:

      set statusline+=%{&ff=~'u'?'u':''}%1*%{&ff=~'u'?'':strpart(&ff,0,1)}%*

      Regards, John

      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
    Your message has been successfully submitted and would be delivered to recipients shortly.