Highlighting the current line number in vim

前端 未结 6 658
忘了有多久
忘了有多久 2021-01-30 20:47

Is there a way to highlight only the current line number (in the left hand coloumn) in vim, without highlighting the background of the current line? Ideally, I

6条回答
  •  不思量自难忘°
    2021-01-30 21:30

    This is what worked for me:

    highlight CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE
    set cursorline
    

    I'm just using this in my .vimrc after having set the color scheme. Of course you could also set a specific background color but setting all of them to NONE just highlights the line number (i.e. makes it brighter).

    I guess you could just use :hi CursorLine cterm=NONE but I just wanted to make sure I'm making everything transparent (gvim included).

    With CursorLineNR I was then able to set the foreground and background colors of the highlighted number.

    I'm only writing this because for me it worked without any autocommands and it may be what most people require.

提交回复
热议问题