[vim/vim] Proposal: Add 'cursorlineopt' option (#4693)

345 views
Skip to first unread message

ichizok

unread,
Jul 17, 2019, 6:34:33 PM7/17/19
to vim/vim, Subscribed

The continuation of https://groups.google.com/forum/#!topic/vim_dev/dQ-5znirV4Y

I created this pull-req in order to update the patch and test on CI.

Summary:

'cursorlineopt' changes the behavior of 'cursorline'.
'cursorlineopt' accepts one of the following string values:

  • line: Highlight the screen line of the cursor with CursorLine.
  • number: Highlight only the line number of the cursor with CursorLineNr.
  • both (default): line and number. This is the current behavior.

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/4693

Commit Summary

  • Add 'cursorlineopt' option
  • Add test_cursorline

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Christian Brabandt

unread,
Jul 18, 2019, 2:16:55 AM7/18/19
to vim/vim, Subscribed

can we add an option, that makes CursorLine highlight only the current screen line (in contrast to the complete physical line that might span several screen lines). This can be annoying. I have an old patch for that behaviour (that introduces the cursorscreenline option).

https://groups.google.com/d/msg/vim_dev/1Yc9Z-82Z80/GXrCoPSdi3IJ
https://github.com/chrisbra/vim-mq-patches/blob/master/cursorscreenline

ichizok

unread,
Jul 18, 2019, 3:53:38 AM7/18/19
to vim/vim, Subscribed

There is the user request that want to highlight only the current line number but not line.
It can do by hi CursorLine clear but setting a highlight is somewhat complicated (e.g. when revert previous highlighting).

Bram Moolenaar

unread,
Sep 9, 2019, 4:02:32 PM9/9/19
to vim/vim, Subscribed

Looks ready to include. Christian: You could add the "screenline" option to 'cursorlineopt' and merge in your old patch. Hmm, only question is what to use for "both" then, for highlighting the line number and the screen line? Or would you never highlight the line number and one screen line?

Bram Moolenaar

unread,
Sep 9, 2019, 4:06:28 PM9/9/19
to vim/vim, Subscribed

Closed #4693 via 410e98a.

Christian Brabandt

unread,
Sep 12, 2019, 9:36:14 AM9/12/19
to vim/vim, Subscribed

Christian: You could add the "screenline" option to 'cursorlineopt' and merge in your old patch. Hmm, only question is what to use for "both" then, for highlighting the line number and the screen line? Or would you never highlight the line number and one screen line?

Looking at this currently. It is a bit more effort than initially thought, because the win_line has changed quite a bit in the last couple of years. Currently I am implementing the screenline option for the 'cursorlineopt'. Is there any reason besides backwards-compatibility to not have the cursorline always work on screen lines?

Bram Moolenaar

unread,
Sep 12, 2019, 5:06:19 PM9/12/19
to vim/vim, Subscribed

> > Christian: You could add the "screenline" option to 'cursorlineopt'
> > and merge in your old patch. Hmm, only question is what to use for
> > "both" then, for highlighting the line number and the screen line?
> > Or would you never highlight the line number and one screen line?
>
> Looking at this currently. It is a bit more effort than initially
> thought, because the `win_line` has changed quite a bit in the last
> couple of years. Currently I am implementing the screenline option for
> the `'cursorlineopt'`. Is there any reason besides
> backwards-compatibility to not have the cursorline always work on
> screen lines?

I assume some users will like the whole line the be highlighted, so that
it's easy to see where it starts and ends. Some people would have a
slightly differently colored background, so it doesn't stand out so
much.

hi CursorLine cterm=NONE ctermbg=254

--
"Marriage is when a man and woman become as one; the trouble starts
when they try to decide which one"

/// 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 ///
Reply all
Reply to author
Forward
0 new messages