How to get the list of all installed color schemes in Vim?

ListVimColor Scheme

List Problem Overview


Is there a way to get a list of all installed color schemes in Vim? That would make very easy to select one without looking at the .vim directory.

List Solutions


Solution 1 - List

Type

:colorscheme then Space followed by TAB.

or as Peter said,

:colorscheme then Space followed by CTRLd

The short version of the command is :colo so you can use it in the two previous commands, instead of using the "long form".

If you want to find and preview more themes, there are various websites like Vim colors

Solution 2 - List

You can see the list of color schemes under /usr/share/vim/vimNN/colors (with NN being the version, e.g. vim74 for vim 7.4).

This is explained here.

On the linux servers I use via ssh, TAB prints ^I and CTRLd prints ^D.

Solution 3 - List

Just for convenient reference as I see that there are a lot of people searching for this topic and are too laz... sorry, busy, to check for themselves (including me). Here is a list of the default set of colour schemes for Vim 7.4:

blue.vim
darkblue.vim,
delek.vim
desert.vim
elflord.vim
evening.vim
industry.vim                                                                                                                                                 
koehler.vim                                                                                                                                                  
morning.vim                                                                                                                                                  
murphy.vim                                                                                                                                                   
pablo.vim                                                                                                                                                    
peachpuff.vim                                                                                                                                                
ron.vim                                                                                                                                                      
shine.vim                                                                                                                                                    
slate.vim                                                                                                                                                    
torte.vim                                                                                                                                                    
zellner.vim 

Solution 4 - List

If you are willing to install a plugin, I recommend https://github.com/vim-scripts/CycleColor.

to cycle through all installed colorschemes. Nice way to easily choose a colorscheme.

Solution 5 - List

Here is a small function I wrote to try all the colorschemes in $VIMRUNTIME/colors directory.

Add the below function to your vimrc, then open your source file and call the function from command.

function! DisplayColorSchemes()
   let currDir = getcwd()
   exec "cd $VIMRUNTIME/colors"
   for myCol in split(glob("*"), '\n')
      if myCol =~ '\.vim'
	     let mycol = substitute(myCol, '\.vim', '', '')
     	 exec "colorscheme " . mycol
	     exec "redraw!"
         echo "colorscheme = ". myCol
	     sleep 2
      endif
   endfor
   exec "cd " . currDir
endfunction

Solution 6 - List

If you have your vim compiled with +menu, you can follow menus with the :help of console-menu. From there, you can navigate to Edit.Color\ Scheme to get the same list as with in gvim.

Other method is to use a cool script ScrollColors that previews the colorschemes while you scroll the schemes with j/k.

Solution 7 - List

Looking at my system's menu.vim (look for 'Color Scheme submenu') and @chappar's answer, I came up with the following function:

" Returns the list of available color schemes
function! GetColorSchemes()
   return uniq(sort(map(
   \  globpath(&runtimepath, "colors/*.vim", 0, 1),  
   \  'fnamemodify(v:val, ":t:r")'
   \)))
endfunction

It does the following:

  1. Gets the list of available color scheme scripts under all runtime paths (globpath, runtimepath)
  2. Maps the script paths to their base names (strips parent dirs and extension) (map, fnamemodify)
  3. Sorts and removes duplicates (uniq, sort)

Then to use the function I do something like this:

let s:schemes = GetColorSchemes()
if index(s:schemes, 'solarized') >= 0
   colorscheme solarized
elseif index(s:schemes, 'darkblue') >= 0
   colorscheme darkblue
endif

Which means I prefer the 'solarized' and then the 'darkblue' schemes; if none of them is available, do nothing.

Solution 8 - List

A great solution, and my thanks to your contributors. For years I've been struggling with a totally crappy color scheme -- using SSH under Windows Vista to a Redhat system, terminal type xterm. The editor would come up with a black background and weird colors for various keywords. Worse -- that weird color scheme sticks in the xterm terminal after leaving Vim.

Really confusing.

Also, Backspace failed during an insert mode, which was nasty to remember -- though Delete did the same thing.

The cure --

  1. In the SSH monitor, select Edit/Settings.

a. Choose Profile Settings/Colors

b. check 'enable ANSI colors'

c. The standard Text colors are probably OK 2. Add these lines to $HOME/.vimrc:

colorscheme default

if &term == "xterm"

set t_kb=^H

fixdel

endif

  1. NOTE: the ^H MUST be typed as ctrl-V ctrl-H. Seems peculiar, but this seems to work.

Solution 9 - List

i know i am late for this answer but the correct answer seems to be

See :help getcompletion():

:echo getcompletion('', 'color')

which you can assign to a variable:

:let foo = getcompletion('', 'color')

or use in an expression register:

:put=getcompletion('', 'color')

This is not my answer, this solution is provided by u/romainl in this post on reddit.

Solution 10 - List

Try

set wildmenu
set wildmode=list:full
set wildcharm=<C-z>
let mapleader=','
nnoremap <leader>c :colorscheme <C-z><S-Tab>

in your ~/.vimrc.

The first two lines make possible matches appear as lists. You can use either or both.

The fourth line makes leader , instead of the default \.

The last line allows you to simply type ,c to get a list and a prompt to change your colorscheme.

The third line effectively allows for Tabs to appear in key maps.

(Of course, all of these strategies I've learned from the internet, and mostly SO, very recently.)

Solution 11 - List

Another simpler way is while you are editing a file - tabe ~/.vim/colors/ ENTER Will open all the themes in a new tab within vim window.

You may come back to the file you were editing using - CTRL + W + W ENTER

Note: Above will work ONLY IF YOU HAVE a .vim/colors directory within your home directory for current $USER (I have 70+ themes)

> [user@host ~]$ ls -l ~/.vim/colors | wc -l > 72

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
QuestiontunnuzView Question on Stackoverflow
Solution 1 - ListXavier T.View Answer on Stackoverflow
Solution 2 - ListFabienView Answer on Stackoverflow
Solution 3 - Listrunlevel0View Answer on Stackoverflow
Solution 4 - ListJohn C EarlsView Answer on Stackoverflow
Solution 5 - ListchapparView Answer on Stackoverflow
Solution 6 - Listmike3996View Answer on Stackoverflow
Solution 7 - ListroyView Answer on Stackoverflow
Solution 8 - ListWilliam BarrettView Answer on Stackoverflow
Solution 9 - ListjustrajdeepView Answer on Stackoverflow
Solution 10 - ListBrady TrainorView Answer on Stackoverflow
Solution 11 - Listnitinr708View Answer on Stackoverflow