1

Inside my home dir I have 2 .vimrc files (.vimrc and .vimrc2). They both use the same coloscheme badwolf.vim. Location of colorscheme is ~/.vim/colors/badwolf.vim If I execute:

vim

everything looks as expected.

But if I do:

vim -u .vimrc2

I get a lot of error messages and colorscheme does not load.

Error detected while processing /home/user1/.vimrc2[6]../home/user1/.vim/colors/badwolf.vim[2337]..function <SNR>3_acquire_theme_data[29]..<SNR>3_register_default_theme:
...
E121: Undefined variable: s:fg_aqua
line  654:
E121: Undefined variable: s:fg_purple
line  655:
E121: Undefined variable: s:fg_purple
...

my .vimrc2 is:

set relativenumber
set encoding=UTF-8
set background=dark
colorscheme badwolf

I tried to use runtime vars in the .vimrc2, but it did not help:

set rtp+="/home/user1/.vim/"
set rtp+="/home/user1/.vim/colors/"
8
  • Welcome to Vim :-) Could you tell us how the badwolf colorscheme is installed (as a plugin or as a file in ~/.vim/colors) where is the badwolf.vim file in your ~/.vim hierarchy? Commented Feb 23 at 17:13
  • 1
    as a file under ~/.vim/colors/badwolf.vim Commented Feb 23 at 17:17
  • 2
    Try vim -Nu .vimrc2
    – Matt
    Commented Feb 23 at 17:28
  • 1
    It works! Thanks! Commented Feb 23 at 17:34
  • 1
    Vivian, it is a custom colorscheme based on badwolf and other one. I did it by myself. Matt comment worked for me. My bad! Thanks! Commented Feb 23 at 17:45

1 Answer 1

1

Thanks Matt and Vivian => the answer is:

vim -Nu .vimrc2

Ref: The command "set nocompatible" in Vim is used to disable compatibility mode, which makes Vim behave more like Vi, the original Unix visual text editor. By default, Vim starts in compatible mode to maintain compatibility with Vi, but by issuing "set nocompatible" in your Vim configuration (typically in your .vimrc file), you're telling Vim to use its own enhanced functionality and features.

4
  • An explanation of WHY that extra -N solves your problem, with pointers to the relevant doc, would be welcome.
    – romainl
    Commented Feb 23 at 18:03
  • 1
    Note that 'by default' is not perfectly accurate. If you have no vimrc file Vim will source $VIMRUNTIME/defaults.vim that set the nocompatible option. Commented Feb 23 at 19:04
  • Feel free to accept your answer in two days. It allow the question to rest :-) Commented Feb 23 at 19:06
  • More importantly, unless you use -u having a vimrc makes Vim nocompatible. That’s why vim works but vim -u ~/.vimrc doesn’t.
    – D. Ben Knoble
    Commented Feb 24 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.