On 11/10/10 01:16, Thomas Adam wrote:
On 10 October 2010 00:47, Tony Mechelynck<[email protected]>  wrote:
- To display the window number on the status line: use a custom status line
(see http://vim.wikia.com/wiki/Show_fileencoding_and_bomb_in_the_status_line
for an example) and include in it the string

    %{winnr()}

where you want the window number to appear. Add any spaces, punctuation,
etc. to your liking outside the %{...} and remember that in the operand of a
:set statement, any spaces, double quotes, vertical bars or backslashes must
be backslash-escaped.

This is interesting.  What would I need to go away and read to
conditionally only display this number if there's>1 split window?  I
basically only want to display that number from ${winnr()} if I've
split a window, not if it just contains one split.

Kindly,

-- Thomas Adam


Well, display that if the highest window number is greater than one, otherwise display the empty string at the same location:

        if has('statusline') && has('windows')
                set stl=%{winnr('$')\ >\ 1?winnr().')':''}…
        endif

replacing the … by the rest of your custom statusline settings: this should display 1) 2) 3) etc. as a prefix at the left end of your statuslines if there are more than one, or no prefix if only one (split) window is present (and give no error when running in a Vim instance with limited capabilities: that's the purpose of the ":if" wrapper). There are (intentionally) no double quotes in that option value.

See
        :help winnr()
        :help 'statusline'
        :help expr1
        :help option-backslash
        " etc.

Best regards,
Tony.
--
"Why are we importing all these highbrow plays like `Amadeus'?  I could
have told you Mozart was a jerk for nothing."
                -- Ian Shoales

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

Reply via email to