How to change the color of the selected code (Vim scheme)?

后端 未结 5 816
遇见更好的自我
遇见更好的自我 2021-02-03 22:42

How do I change the color of the selected code in Vim?

There are three selection modes, Visual Line mode or Visual Block mode, and selecting wi

相关标签:
5条回答
  • 2021-02-03 23:19

    My highlight

    :hi Visual cterm=none ctermbg=darkgrey ctermfg=cyan
    

    More xterm colors: https://github.com/guns/xterm-color-table.vim

    0 讨论(0)
  • 2021-02-03 23:29

    mu color scheme is molokai, and I found that this configuration is the best for me:

    highlight Visual cterm=bold ctermbg=Blue ctermfg=NONE

    check out my vimrc @https://github.com/reubinoff/myVimrc

    0 讨论(0)
  • 2021-02-03 23:35

    How to set the color of the selected code in vi?

    I'm using VIM 7.3 on Ubuntu and this does it for me within the editor:

    :syntax on 
    :hi Visual term=reverse cterm=reverse guibg=Grey
    

    I'm using a colorscheme defined in the /home/youruser/.vim/colors/mycolorscheme.vim file. I set the command there and the changes take effect when vim starts.

    syntax on
    hi Visual term=reverse cterm=reverse guibg=Grey
    
    0 讨论(0)
  • 2021-02-03 23:38

    Selection color for gvim is set by the following line:

    hi Visual  guifg=#000000 guibg=#FFFFFF gui=none
    

    You can use named color values instead of the #nnnnnn RGB codes. Your existing line is set for black foreground and white background, just as you observed.

    For example, if you want a light blue background with white foreground:

    hi Visual  guifg=White guibg=LightBlue gui=none
    

    Be sure the color file you are editing is in the vim7x/colors directory so both vim and gvim can find it. Its exact location can vary a bit depending on your OS platform.

    0 讨论(0)
  • 2021-02-03 23:41

    I just change my color scheme file (~/.vim/colors/solarized.vim), and set 'Visual' to the same value as 'CursorLine'.

    I like the style of CursorLine as it is transparent and keep the selected elements's syntax highlight color.

    Replace the line that contains exe "hi! Visual" with the following line:

    exe "hi! Visual"     .s:fmt_uopt   .s:fg_none   .s:bg_base02  .s:sp_base1
    

    or:

    :highlight Visual cterm=NONE ctermbg=0 ctermfg=NONE guibg=Grey40
    

    Like so:

    0 讨论(0)
提交回复
热议问题