在vim中突出显示当前行号 [英] Highlighting the current line number in vim

查看:69
本文介绍了在vim中突出显示当前行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 vim 中突出显示当前行号(在左侧列中),而不突出显示当前行的背景?理想情况下,我想让当前行号粗体.

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 would Like to make the current line number bold.

推荐答案

&cursorline 选项处于活动状态时,有两个组决定了显示行的突出显示:CursorLineCursorLineNR.第一个用于突出显示整行,第二个用于行号.所以要达到你想要的,你必须

There are two groups that determine highlighting of line displayed when &cursorline option is active: CursorLine and CursorLineNR. First is used to highlight the whole line, second for the line number. So to achieve what you want you must

  1. 清除CursorLine的高亮:只需hi clear CursorLine 在任何:colorscheme设置背景之后= 调用.

  1. Clear the highlighting of CursorLine: just hi clear CursorLine after any :colorscheme and set background= call.

hi clear CursorLine
augroup CLClear
    autocmd! ColorScheme * hi clear CursorLine
augroup END

  • 如果您的配色方案中没有设置 CursorLineNR 的突出显示:

    hi CursorLineNR cterm=bold
    augroup CLNRSet
        autocmd! ColorScheme * hi CursorLineNR cterm=bold
    augroup END
    

    (最好检查一下是否已经在colorscheme中设置了,那样的话看起来会更好).

    (better to check whether it is already set in the colorscheme, maybe it will look better in that case).

    您可以将两个自动命令合二为一.

    You can join both autocommands in one of course.

    CursorLineNR 是最近在 7.3.488 版本附近添加的.

    CursorLineNR has been added relatively recently around version 7.3.488.

    这篇关于在vim中突出显示当前行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆