k0n3ru
k0n3ru

Reputation: 703

colorscheme set in .vimrc is not being applied

I have installed zenburn colorscheme to ~/.vim/colors and am trying to enable it by default in the .vimrc file.

I have added colorscheme zenburn to my .vimrc file but the colorscheme is not enabled after vim starts. If I manually do :colorscheme zenburn it sets the colorscheme.

If I enable a colorscheme that comes with vi ( for eg desert ) in vimrc, its being enabled at vim startup.

This is my vimrc

filetype plugin on      
filetype indent on      

set nocompatible        
set history=500         
syntax on               
set expandtab           
set tabstop=4           
set shiftwidth=4        
set softtabstop=4       
set number              
set autoindent          
set cindent             
set showmatch           
set matchtime=5         
set ruler               
set laststatus=2        
set hlsearch            
set incsearch           
set cursorline          
set scrolloff=5         
"set nowrap             
set foldenable          
set foldmarker={,}      
set foldmethod=marker   
set foldlevel=100       
"set mouse=a            
"set mouse=r            
colorscheme zenburn

What should I do to get zenburn colorscheme enabled at startup ?

Upvotes: 3

Views: 7852

Answers (7)

codiggermkt
codiggermkt

Reputation: 1

You can use the customised colour scheme as the default const g:colors_name = "zenburn". Make sure there aren't any lines in your .vimrc that might be overriding the colorscheme zenburn line. For example, another colorscheme setting later in the file could be taking precedence. Double-check that you've installed the Zenburn colorscheme in the correct location. It should be in ~/.vim/colors/zenburn.vim. You can try typing :verbose colorscheme into Vim; Vim will display the current color theme and the file location, to help you further troubleshoot the problem.

Upvotes: 0

preachers
preachers

Reputation: 381

In my case the issue is caused by running sudo vim. I have the colorscheme applied without problems before, but now it refuse to take effect at all. It turns out that by adding sudo before vim, the program loads /root/.vimrc instead of ~/.vimrc. Just copy the file from your home directory to /root/ and voila!

Upvotes: 0

Dan
Dan

Reputation: 1

I had the same problem, and I found the following solution: in your .cshrc file (or equivalent in your .bashrc file), add the following line: alias vi 'vim "+colorscheme my_scheme"' Pay attention to the quotes and double quotes.

Upvotes: 0

Nenoj
Nenoj

Reputation: 197

try

set colorscheme zenburn
# or 
set color zenburn

Upvotes: -2

kzygmans
kzygmans

Reputation: 358

In my case when colorscheme was the only command in .vimrc it did not work. I had to add syntax on command at the end to make it work.

$ cat ~/.vimrc
colorscheme zenburn
syntax on

Upvotes: 5

Kanwar Baweja
Kanwar Baweja

Reputation: 315

I had a similar issue, try putting the command for colorscheme at the bottom of .vimrc

Upvotes: 0

t0d0r
t0d0r

Reputation: 48

Try to load .vimrc file again after vim is started with :source ~/.vimrc Did the colorscheme changes?

Also if you use graphical vim, there is second file that can override your settings ~/.gvimrc

Upvotes: 1

Related Questions