[proposal] new 'cursorlinenr' option

200 views
Skip to first unread message

Ozaki Kiichi

unread,
Mar 20, 2015, 4:52:01 PM3/20/15
to vim...@googlegroups.com
Hi.

I propose a new option 'cursorlinenr' to enable highlighting the line number of cursor.

[motive]

I think that the present spec, applying hl-CursorLineNr depends on 'cursorline' or 'relativenumber', isn't much convenient.

[spec]

'cursorlinenr' 'culn' boolean (default unset(-1))
local to window
Highlight the line number of the cursor with CursorLineNr
hl-CursorLineNr. Will make screen redrawing slower.
If this option is unset, highlighting depends on 'cursorline' or
'relativenumber'.

https://gist.github.com/ichizok/8d016c1e4c791499d092

Thank you.
- Ozaki Kiichi

Ozaki Kiichi

unread,
Jul 18, 2015, 7:57:52 AM7/18/15
to vim...@googlegroups.com
I updated the patch; add syntax.vim changes

https://gist.github.com/ichizok/8d016c1e4c791499d092

Ozaki Kiichi

unread,
Nov 26, 2016, 9:15:23 PM11/26/16
to vim_dev

Gary Johnson

unread,
Nov 27, 2016, 1:08:13 PM11/27/16
to vim_dev
On 2016-11-26, Ozaki Kiichi wrote:
> I updated; changed type of 'cursorlinenr' to number.
>
> https://gist.github.com/ichizok/8d016c1e4c791499d092

From your description, this option behaves like a boolean. Why
would you use the numerical values 1 and -1 instead?

Regards,
Gary

Ozaki Kiichi

unread,
Nov 28, 2016, 11:56:02 AM11/28/16
to vim_dev, gary...@spocom.com
> From your description, this option behaves like a boolean. Why
> would you use the numerical values 1 and -1 instead?

Sorry for lack of a description about 'cursorlinenr=0'. I have fixed it.

That is, 'cursorlinenr' is set to:

1: highlighting the line number
0: no highlighting
-1: highlighting depends on 'cursorline' or 'relativenumber'
(this is current behavior.)

In the previous patch, type of 'cursorlinenr' was boolean.
But it must set default value to other than 'on' and 'off', i.e. 'unset' (-1) for the
compatibility with current behavior, and I was not sure whether 'unset' can be
permitted.
(and changing value 'unset' to 'on' or 'off' is irreversible)

Thank you.

Bram Moolenaar

unread,
Nov 28, 2016, 4:00:21 PM11/28/16
to vim...@googlegroups.com, Ozaki Kiichi, gary...@spocom.com
Using the magic numbers is hard to understand. New options are probably
better done with string values, such as "on", "off", and empty for not
set. Perhaps in this case "number", "line" and "both"? But then naming
it 'cursorlineopt' would be better.

--
"I can't complain, but sometimes I still do." (Joe Walsh)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Gary Johnson

unread,
Nov 28, 2016, 4:15:11 PM11/28/16
to vim...@googlegroups.com
On 2016-11-28, Bram Moolenaar wrote:
> Ozaki Kiichi wrote:
>
> > > From your description, this option behaves like a boolean. Why
> > > would you use the numerical values 1 and -1 instead?
> >
> > Sorry for lack of a description about 'cursorlinenr=0'. I have fixed it.
> >
> > That is, 'cursorlinenr' is set to:
> >
> > 1: highlighting the line number
> > 0: no highlighting
> > -1: highlighting depends on 'cursorline' or 'relativenumber'
> > (this is current behavior.)
> >
> > In the previous patch, type of 'cursorlinenr' was boolean.
> > But it must set default value to other than 'on' and 'off', i.e. 'unset' (-1) for the
> > compatibility with current behavior, and I was not sure whether 'unset' can be
> > permitted.
> > (and changing value 'unset' to 'on' or 'off' is irreversible)
>
> Using the magic numbers is hard to understand. New options are probably
> better done with string values, such as "on", "off", and empty for not
> set. Perhaps in this case "number", "line" and "both"? But then naming
> it 'cursorlineopt' would be better.

One has to remember, too, that if an option is a string and "global
or local to buffer", the only way (that I know of) to set the local
value to track the global value is to set the local value to empty.
Therefore, empty should not have any other special meaning. See
":help global-local".

Regards,
Gary

Ozaki Kiichi

unread,
Nov 29, 2016, 1:18:57 PM11/29/16
to vim_dev, gclien...@gmail.com, gary...@spocom.com
> Using the magic numbers is hard to understand. New options are probably
> better done with string values, such as "on", "off", and empty for not
> set. Perhaps in this case "number", "line" and "both"? But then naming
> it 'cursorlineopt' would be better.

I have tried making out 'cursorlineopt' patch.

https://gist.github.com/ichizok/691aa7e848afd4aa8229c7a51aec895b

And test (also requires https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI).

https://gist.github.com/ichizok/698abaef579911ec5157ba2be138739c

Thank you.

Ozaki Kiichi

unread,
Nov 30, 2016, 10:08:25 PM11/30/16
to vim_dev
I updated patches.

Change: test_cursorline.vim requires only view.vim of https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI .

Ozaki Kiichi

unread,
Jul 17, 2019, 6:37:45 PM7/17/19
to vim_dev
Reply all
Reply to author
Forward
0 new messages