On Tue, January 29, 2013 15:51, Nazri Ramliy wrote:
> On Tue, Jan 29, 2013 at 6:21 PM, Paul Ruane <[email protected]> wrote:
>> Whilst it is not that hard to scan the status line, I find that I hit
>> this glitch in my workflow many, many times a day: when I want to know
>> what line I am on, I intuitively scan the gutter for the line number.
>> I then realise that relativenumber is on so I redirect my attention to
>> the status line and then have to parse the number from the other
>> fields down there.
>
> The following patch does what you want. After trying it out for a few
> minutes
> it does feel easier to find out the current line number. I normally
> have the line
> number in my statusline, and on the occasion where the statusline is not
> shown
> I've trained my fingers to hit Ctrl+G and scan the bottom line for the
> line number.
>
> Having the current line number, instead of a '0' shown at the current line
> seems
> more useful. For better distinction the current line number ca be
> left-aligned
> (for left-to-right text orientation) to make it look different than the
> relative-line-numbers (I made no attempt at this in the patch below).
>
> Others might find it weird.
>
> patch follows:
>
> --8<--
> diff -r 990d0f9400dc src/misc2.c
> --- a/src/misc2.c       Sat Jan 19 14:02:02 2013 +0100
> +++ b/src/misc2.c       Tue Jan 29 22:36:00 2013 +0800
> @@ -515,7 +515,7 @@
>  #endif
>         retval = lnum - cursor;
>
> -    return retval;
> +    return retval == 0 ? lnum : retval;
>  }
>
>  /*
> diff -r 990d0f9400dc src/screen.c
> --- a/src/screen.c      Sat Jan 19 14:02:02 2013 +0100
> +++ b/src/screen.c      Tue Jan 29 22:36:00 2013 +0800
> @@ -10238,12 +10238,7 @@
>      int                n;
>      linenr_T   lnum;
>
> -    if (wp->w_p_nu)
> -       /* 'number' */
> -       lnum = wp->w_buffer->b_ml.ml_line_count;
> -    else
> -       /* 'relativenumber' */
> -       lnum = wp->w_height;
> +    lnum = wp->w_buffer->b_ml.ml_line_count;
>
>      if (lnum == wp->w_nrwidth_line_count)
>         return wp->w_nrwidth_width;
> -->8--

That indeed looks like a helpful extensions, but I suggest to
highlight the current (absolute) linenumber differently, otherwise
it might be confusing in a file with the cursor at the top:

1 foobar
1 blah
2 fasel

regards,
Christian

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui