Home  >  Q&A  >  body text

Vim highlights the line where the cursor is located. The default highlighting effect is the bottom horizontal line. How to change it to background highlighting?

It’s like this. The bottom edge covers the symbol. It’s very uncomfortable to write code. How to set the line background highlight

阿神阿神2712 days ago928

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 16:36:36

    Solution

    Just add the following setting code~/.vimrc. For specific colors, test it yourself

    set cursorcolumn  "or set cuc 设置光标所在的列
    set cursorline    "or set cul 设置光标所在的行
    " cterm 表示原生vim设置央视, 设置为NONE表示可以自定义设置
    " red(红),white(白),black(黑),green(绿),yellow(黄),blue(蓝),purple(紫),
    " gray(灰),brown(棕),tan(褐色),syan(青色)
    " 更多高亮颜色设置, 可以:h highlight 查看manual
    "highlight CursorLine   cterm=NONE ctermbg=blue ctermfg=NONE guibg=NONE guifg=NONE
    "highlight CursorColumn cterm=NONE ctermbg=blue ctermfg=NONE guibg=NONE guifg=NONE

    Notes

    If you have set a theme style, as shown below, most theme styles use underline. .vimrc的样式, 后面的会覆盖前面的. Therefore, you need to put the background highlight style behind the theme.

    " /usr/sare/vim/vim80/colors
    "colorscheme elflord
    "colorscheme koehler
    "colorscheme pablo
    "colorscheme delek
    "colorscheme evening
    "colorscheme slate
    "colorscheme darkblue
    "colorscheme desert
    "colorscheme industry
    colorscheme murphy
    "colorscheme ron
    "colorscheme torte
    "colorscheme molokai
    

    reply
    0
  • Cancelreply