How to set default vim colorscheme

VimColor Scheme

Vim Problem Overview


The latest upgrade of Ubuntu made my vim colorscheme unusable. I know how to set it manually (:colo evening, for example), but I want to set the default for all vim sessions. I see reference in other places to .vimrc, but the right location and syntax have eluded me thus far.

Vim Solutions


Solution 1 - Vim

Put a colorscheme directive in your .vimrc file, for example:

colorscheme morning

See here: http://vim.wikia.com/wiki/Change_the_color_scheme

Solution 2 - Vim

Your .vimrc file goes in your $HOME directory. In *nix, cd ~; vim .vimrc. The commands in the .vimrc are the same as you type in ex-mode in vim, only without the leading colon, so colo evening would suffice. Comments in the .vimrc are indicated with a leading double-quote.

To see an example vimrc, open $VIMRUNTIME/vimrc_example.vim from within vim

:e $VIMRUNTIME/vimrc_example.vim

Solution 3 - Vim

It's as simple as adding a line to your ~/.vimrc:

> colorscheme color_scheme_name

Solution 4 - Vim

You can try too to put this into your ~/.vimrc file:

colorscheme Solarized

Solution 5 - Vim

You can just use the one-liner

echo colorscheme koehler >> ~/.vimrc

and replace koehler with any other available colorscheme. Imho, all of them are better than default.

Solution 6 - Vim

What was asked for was to set:

  • the 'default', not some other color profile, and

  • 'for all vim sessions', not simply for the current user.

The default colorscheme, "for all vim sessions", is not set simply by adding a line to your ~/.vimrc, as all of the other answers here say, nor is the default set without the word 'default' being there.

So all of the other answers here, so far, get both of these wrong. (lol, how did that happen?)


The correct answer is:

Add a line to your system vim setup file in /etc/vim/ that says

colorscheme default

or using the abbreviation

colo default

but not capitalized as

colo Default

(I suggest using the full, un-abbreviated term 'colorscheme', so that when you look at this years later you'll be able to more easily figure out what that darn thing does. I would also put a comment above it like "Use default colors for vim".)


To append that correctly, first look at your /etc/vim/vimrc file.

At the bottom of mine, I see these lines which include /etc/vim/vimrc.local:

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif

So you can append this line to either of these two files.

I think the best solution is to append your line to /etc/vim/vimrc.local like this:

> colorscheme default


You can easily do that in bash with this line:

$ echo -e "\"Use default colors for vim:\ncolorscheme default"  \
   |  sudo tee -a /etc/vim/vimrc.local

# 
#     NOTE:  This doesn't work:
#
#       $ sudo echo 'colorscheme default'  >> /etc/vim/vimrc.local
#
#     It's the same general idea, and simpler, but because sudo doesn't
#     know how to handle pipes, it fails with a `Permission denied` error.

Also check that you have permission to globally read this file:

sudo chmod 644 /etc/vim/vimrc.local

With $ tail /etc/vim/vimrc.local you should now see these lines:

"Use default colors for vim:
colorscheme default

Solution 7 - Vim

Once you’ve decided to change vim color scheme that you like, you’ll need to configure vim configuration file ~/.vimrc.

For e.g. to use the elflord color scheme just add these lines to your ~/.vimrc file:

colo elflord

For other names of color schemes you can look in /usr/share/vim/vimNN/colors where NN - version of VIM.

Solution 8 - Vim

Ubuntu 17.10 default doesn't have the ~/.vimrc file, we need create it and put the setting colorscheme color_scheme_name in it.

By the way, colorscheme desert is good scheme to choose.

Solution 9 - Vim

Copy downloaded color schemes to ~/.vim/colors/Your_Color_Scheme.

Then write

colo Your_Color_Scheme

or

colorscheme Your_Color_Scheme

into your ~/.vimrc.

See this link for holokai

Solution 10 - Vim

OS: Redhat enterprise edition

colo schema_name works fine if you are facing problems with colorscheme.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJoe MasteyView Question on Stackoverflow
Solution 1 - VimchickeninabiscuitView Answer on Stackoverflow
Solution 2 - VimrampionView Answer on Stackoverflow
Solution 3 - VimJonesView Answer on Stackoverflow
Solution 4 - VimhernanvicenteView Answer on Stackoverflow
Solution 5 - VimAndrey RegentovView Answer on Stackoverflow
Solution 6 - VimElliptical viewView Answer on Stackoverflow
Solution 7 - VimfuserView Answer on Stackoverflow
Solution 8 - VimKey ShangView Answer on Stackoverflow
Solution 9 - VimhamidooView Answer on Stackoverflow
Solution 10 - Vimsaumitra mallickView Answer on Stackoverflow