I'm running Vim 8.2 on macOS 10.14.6 (Mojave) on the native macOS Terminal program. I recently changed my terminal font to Courier 12, Regular weight, and discovered a strangely annoying issue which seems to be specific to this font. I've looked online about this issue but unfortunately did not come across anything.

When using the Netrw directory listing, as I scroll down the cursorline disappears. When I scroll up, the cursorline remains in every line through which I have scrolled up. Oddly, when I scroll up above the top of the terminal window, the cursorline seems to reset to only the current line. If I switch the font, the cursorline always is under only the currently selected line, as expected.

A picture is attached below. I took this immediately after scrolling to the bottom of the directory listing and then scrolling back up to the top.

After scrolling from the bottom to the top

From what I can tell, my .vimrc (following) should not affect the cursorline:

:set autoindent

:set number

:set ruler

:set expandtab
function! SetTabSize(size)
    execute "set tabstop=".a:size
    execute "set shiftwidth=".a:size
    execute "set softtabstop=".a:size
command! -nargs=1 Sts call SetTabSize(<f-args>)
:Sts 2

:syntax on

Has anyone else experienced this issue? Is there a solution? Perhaps there is something I am missing. Thank you!

  • Welcome to Vi and Vim! Looks like an issue with the MacOS Terminal.app, which is known to be somewhat buggy... Maybe try iTerm 2 and see if it also happens there? At least, if it does, you know one more place where the same issue seems to reproduce... Cheers!
    – filbranden
    Jun 3 at 19:17
  • 1
    Idk if Terminal.app is known to be buggy @filbranden but it isn't as "feature-complete" as other terminals. OP, what does :set term? and :echo $TERM give?
    – D. Ben Knoble
    Jun 3 at 19:23
  • :set term? gives term=xterm-256color, and :echo $TERM gives xterm-256color. @D. Ben Knoble
    – MattS
    Jun 3 at 21:26
  • That matches what I have on my system. I can't reproduce this with vim -Nu /tmp/yourvimrc -U NONE, :colo default, :set cursorline, :Explore on Terminal.app and vim 8.2.2300
    – D. Ben Knoble
    Jun 4 at 18:34
  • Weird...the issue persists running exactly the commands you most recently gave. Sounds like a new terminal app for me then. But thanks for your help!
    – MattS
    Jun 5 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.