vim / colorschemes

colorschemes for Vim
274 stars 23 forks source link

How to: legacy #252

Closed az-z closed 5 months ago

az-z commented 6 months ago

Hello, apologies in advance, as I'm just trying to make sense of vim infrastructure... How can i use the color schemes from "legacy" folder? I understand that ./plugged/colorschemes/colors override the schemes names from the stock themes ( /usr/share/vim/vim90/colors/). And are available thru "colorscheme" command.

Appreciate you looking into this question. AZ

romainl commented 6 months ago

To use the legacy colorschemes that we provide in the legacy_colors directory instead of the ones distributed with Vim, do the following:

  1. Create the following directory structure if it doesn't exist already:

    ~/.vim/pack//start/legacy_colors/colors

    Use whatever name you want instead of <foobar>.

  2. Copy the content of this repo's legacy_colors directory into the colors directory you just created.

  3. DONE

romainl commented 6 months ago

FWIW, I just packaged the legacy colorschemes as a more convenient "plugin" that you can install using your preferred method: https://github.com/romainl/vim-legacy-colorschemes.

(I think someone already did that but I couldn't find it so, there)

az-z commented 6 months ago

@romainl , thank you for the reply. Is it correct to understand that vim is looking for "colors" directory to load schemes? If the statement is true, how does it handle schemes with the same name? let's say : .vim/pack/foo/colors/blue .vim/pack/bar/colors/blue .vim/packNEW/foo/colors/blue

Thank you for making a new schemes. The darkblue made me emotional yesterday... flashbacks to Borland times. But looks significantly better.

romainl commented 6 months ago

See :help :runtime. Doing:

:colorscheme blue

is essentially like doing:

:runtime colors/blue.vim

where Vim is going to try to source the first colors/blue.vim it finds in every directory listed in :help 'runtimepath'.

With the default runtimepath:

$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after

it means trying each of the following paths, in the given order:

$HOME/.vim/colors/blue.vim
$VIM/vimfiles/colors/blue.vim
$VIMRUNTIME/colors/blue.vim    <-- built-in "blue" is here
$VIM/vimfiles/after/colors/blue.vim
$HOME/.vim/after/colors/blue.vim

When you use the packages feature or some plugin manager, runtimepath is updated with new paths for each plugin you add. Supposing you are adding my plugin to a "colorschemes" package:

~/.vim/pack/colorschemes/start/vim-legacy-colorschemes

then your runtimepath is going to look like this:

$HOME/.vim,$HOME/.vim/pack/colorschemes/start/vim-legacy-colorschemes,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after

and Vim is going to try each of the following paths:

$HOME/.vim/colors/blue.vim
$HOME/.vim/pack/colorschemes/start/vim-legacy-colorschemes/colors/blue.vim    <-- original "blue" is here
$VIM/vimfiles/colors/blue.vim
$VIMRUNTIME/colors/blue.vim    <-- built-in "blue" is here
$VIM/vimfiles/after/colors/blue.vim
$HOME/.vim/after/colors/blue.vim

In that scenario, Vim will source the first colors/blue.vim it finds, which is the one in the package.

Checking the value of runtimepath should give you a good idea of the order in which your scripts are sourced:

:put=substitute(&runtimepath,',','\n','g')