Vim colorscheme change

岁酱吖の 提交于 2019-12-31 12:52:13

问题


I'm having difficulty getting my colorscheme to change. I've opened both ~/.vimrc and /usr/share/vim/vimrc and added:

colorscheme desert

...and nothing. I noticed the color schemes are here:

/usr/share/vim/vim72/colors/desert.vim (...along with a bunch or others)

which seems like the wrong place so I:

cp /usr/share/vim/vim72/colors/desert.vim ~/.vim/colors/

and still no go.


回答1:


Custom colorschemes should go in ~/.vim/colors/, and adding the colorscheme line in your ~/.vimrc should work. So it sounds like you're doing that right.

Double-check that you don't have some other colorscheme line lower down in your vimrc or in an included config file that might be overriding it.

Also double-check that your .vimrc is being loaded as expected. One easy way to tell is by trying to load a nonexistant colorscheme name - if the line is being parsed, then you should get an error like:

E185: Cannot find color scheme foobarbaz

If your colorscheme line is being correctly parsed, you need to check if your terminal is correctly configured to display the colors.




回答2:


Try setting your terminal colours in your .bashrc/.bash_profile to:

export TERM=xterm-256color

& in your .vimrc

let g:"your_colourscheme"_termcolors=256

& that should stick. Bit of a kludge I know but it should work.

Saves typing

:colorscheme whatever everytime you start Vim




回答3:


The situation with terminals is a mess when it comes to colors and fonts. It is quite probable that your terminal emulator (gnome-terminal? kterm?) and vim aren't using the same encodings for colors, or one is partially overriding the settings of the other. When it comes to the eternal war between console apps and modern colors and font rendering, your three options are:

  1. Side with the old school, switch to xterm or rxvt, where the colors are more likely to just work, but got help you if you want antialiased fonts.
  2. Side with the new school, sidestep the console entirely and use gvim, where fonts and colors will likely both just work.
  3. Get caught in the middle and forever fight with getting fonts and colors to work properly for old console programs running in new terminal emulators, i.e. gnome-terminal, kterm, etc...



回答4:


apt-get install vim or yum install vim    <-- need full vim vs mini vim
ls /usr/share/vim/vim ##/colors           <-- ## 72 or 73, etc list color schemes

cd ~
vi .vimrc
# Add the following two lines if the don't exist
syntax on
colorscheme elflord
# replace elfloard with what ever color scheme you like



回答5:


If you are using vim-tiny in Ubuntu (the default one). Try to install vim-nox, vim-gtk or vim-gnome.




回答6:


make sure that you are enabling syntax with :syntax enable.



来源:https://stackoverflow.com/questions/4037329/vim-colorscheme-change

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!