Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell which colorscheme a Vim session currently uses

People also ask

How do I change the Colorscheme in Vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

What is Vim default Colorscheme?

The default Vim color scheme in a light terminal is peachpuff . If you use a dark terminal, the initial color scheme is ron .

Where does Vim install Colorscheme?

To install a new color scheme for Vim, you will need to download it from the git hub repository. Here I am going to download a vim theme “Monokai” from the Git repository. For Monokai color scheme, open the following link, then right-click and save it as . vim in your Downloads directory.

Where are Neovim color schemes stored?

The full path to it will be ~/. config/nvim/colors/nord.


There's no guaranteed way (as a colour scheme is essentially a load of vim commands that are sourced). However, by convention there should be a variable g:colors_name that is set to the name of the colour scheme.

Therefore, try this:

echo g:colors_name

If you get E121, it's either a poorly made colour scheme or it's the default one.

A shinier way of doing this is (for recent versions of vim):

function! ShowColourSchemeName()
    try
        echo g:colors_name
    catch /^Vim:E121/
        echo "default"
    endtry
endfunction

Then do:

:call ShowColourSchemeName()

If it says "default", do :colorscheme default and see if the colours change. If they do, you're using a malformed colour scheme and there's not a lot you can do about it other than manually switching themes until you recognise it.

The variable g:colors_name is documented here:

:help colorscheme

Best option is to use :colo or :colorscheme in current vim and the actual colorscheme text is shown. Please see,

:help colorscheme 

for more details.


A one-line version of DrAl's answer:

let current_scheme = get(g:, 'colors_name', 'default')

The get() function will fall back to 'default' if the variable has not yet been set.