RSer
RSer

Reputation: 33

Installing VIM colorschemes under Windows 10

I would like to ask for your help regarding the setting up of the VI environment under Windows 10. I successfully downloaded VIm for windows (vim82 on the official website). I want to modify the color scheme. I downloaded a scheme from: https://vimcolors.com/ (let's say for example the scheme "nebula" which is located on page 4 between results 31 and 40 on the vimcolors webpage) and put it in the "colors" subdirectory of the main vim directory: C:\Program Files (x86)\Vim\vim82\colors. Then I edit the "_vimrc" file located at: C:\Program Files (x86)\Vim_vimrc and simply add the line:

colorscheme nebula

The complete _vimrc file then looks like:

" Vim with all enhancements
source $VIMRUNTIME/vimrc_example.vim

" Use the internal diff if available.
" Otherwise use the special 'diffexpr' for Windows.
if &diffopt !~# 'internal'
  set diffexpr=MyDiff()
endif
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg1 = substitute(arg1, '!', '\!', 'g')
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg2 = substitute(arg2, '!', '\!', 'g')
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let arg3 = substitute(arg3, '!', '\!', 'g')
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  let cmd = substitute(cmd, '!', '\!', 'g')
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction

" PERSONAL ENVIRONMENT "
colorscheme nebula

and when I open a text file with VI then this is the message I get - pardon my french - (and the default colorscheme gets loaded up):

Erreur détectée en traitant C:\Program Files (x86)\Vim\vim82\colors\nebula
.vim :

ligne    6 :

E477: Le ! n'est pas autorisé: <!DOCTYPE html>

ligne    7 :

E488: Caractères surnuméraires: <html lang=

ligne    8 :

E488: Caractères surnuméraires:   <head>

ligne    9 :

E488: Caractères surnuméraires:     <meta charset=

ligne   10 :

E488: Caractères surnuméraires:   <link rel=

ligne   11 :

E488: Caractères surnuméraires:   <link rel=

ligne   12 :

E488: Caractères surnuméraires:   <link rel=

ligne   13 :

E488: Caractères surnuméraires:   <link rel=

ligne   14 :

E488: Caractères surnuméraires:   <link rel=

ligne   15 :

E488: Caractères surnuméraires:   <link rel=

ligne   16 :

E488: Caractères surnuméraires:   <link rel=

ligne   20 :

E488: Caractères surnuméraires:   <link crossorigin=

ligne   21 :

E488: Caractères surnuméraires:   <link crossorigin=

ligne   22 :

E488: Caractères surnuméraires:     <link crossorigin=

ligne   29 :

E488: Caractères surnuméraires:   <meta name=

ligne   31 :

E488: Caractères surnuméraires:   <title>vim-nebula/nebula.vim at master 
· stillwwater/vim-nebula · GitHub</title>

And it goes like that for almost every line... VI does find the color scheme file as you can see at the beginning of the error message because the path is correct. I did not do any modifications in the colorscheme file. Does anyone have any idea ? Thanks a lot for your help.

Regards,

Ronan.

Upvotes: 1

Views: 2398

Answers (1)

RSer
RSer

Reputation: 33

The problem is solved thanks to Light. On the webpage of the selected colorscheme, I was simply right-clicking on the nebula.vim presented under the colors sub-directory and selecting "save as..." and yes, I was saving not the file itself but the github webpage... in case that happens to someone else (even though I think I would be the only one stupid enough to do that), you should open the colorscheme.vim that you want, select all, copy, and paste under a filename of the same name in your local vim/colors/ directory. Apologies... And thanks for the help.

Regards.

Upvotes: 1

Related Questions