简体   繁体   English

在vim中以可视模式更改文本选择颜色

[英]Changing text selection color in visual mode in vim

I use black background and white text. 我使用黑色背景和白色文字。 The problem is, when I want to select some text in visual mode, the selected text is NOT visible at all, as both of them are white. 问题是,当我想在可视模式下选择一些文本时,所选文本根本不可见,因为它们都是白色的。 I do not want to switch to light backgrounds. 我不想切换到浅色背景。 How can I change just the text selection color to something else, so that selected text is visible? 如何将文本选择颜色更改为其他颜色,以便所选文本可见?

在此输入图像描述

If the colorscheme is supposed to be a dark colorscheme. 如果colorscheme应该是一个暗色调。 It should automatically have 它应该自动拥有

set background=dark

inside of it. 在里面。 If it doesn't you can add it after the colorscheme is loaded. 如果没有,您可以在加载colorscheme后添加它。 If background is set to dark vim will try to use colors that look good on a dark background. 如果background设置为暗,则vim将尝试使用在深色背景上看起来很好的颜色。

Take a look at :help 'background' 看看:help 'background'

You can configure the colors of a visual selection with hi Visual 您可以使用hi Visual配置视觉选择的颜色

For example, you can set the background in a GUI instance to grey with 例如,您可以将GUI实例中的背景设置为灰色

hi Visual guibg=#AAAAAA

The foreground, and console colors, can also be set the same way with guifg ctermfg and ctermbg 前景和控制台颜色也可以使用guifg ctermfgctermbg以相同的方式设置

Normally this would be set by your colorscheme, but you can set it elsewhere if you want. 通常这将由您的colorscheme设置,但您可以根据需要在其他地方设置它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM