简体   繁体   中英

Setting up Vim Color

I would like to have my Vim background black and foreground color white regardless of the language I am editing (eg bash, Python etc).

How can I save those settings permanently?

How can I do it in Vi/Vim?

Thanks Rio

If you don't know what your .vimrc file is, see this question.

To force vim to use black for background and white for foreground put these commands in your .vimrc

hi Normal ctermfg=white guifg=white ctermbg=black guibg=black

Your colorscheme may get in the way here, highlighting keywords with colors you don't want. If you want to disable that, just disable syntax highlighting.

To do that, add this line in your .vimrc along with the other one

syntax off

This may not work in the terminal, because your terminal may be also setting the background and foreground to different colors. If that is the case, you should look into changing your terminal colorscheme to white on black (it is one of the defaults usually).

You could try to add this at the bottom of your .vimrc file:

syntax off
set nohlsearch

It basically removes all highlighting (also when searching).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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