You are not logged in.

#1 2014-09-27 02:38:07

azurepancake
Member
Registered: 2009-01-19
Posts: 42

Setting Up VIM Colorscheme

Hello,

I'm new to VIM and have been wanting to customize it a little. After reading about setting a "colorscheme", I found one that I liked called "badwolf". I downloaded the scheme and did the following in an attempt to get it working.

I first created directory "~/.vim/colors" and moved "badwolf.vim" into this directory.

I then created a ".vimrc" with the following inside:

colorscheme badwolf
syntax enable
set tabstop=4
set softtabstop=4
set expandtab
set number
set showcmd
set cursorline
set wildmenu
filetype indent on

This is all which I thought needed to be done. I then loaded VIM and it appears that some changes had taken effect, but not all.

I then tried to load the file manually from inside VIM like so:

:colorscheme badwolf

It now completely loads the colorscheme! I did a little research and found that it may be overridden by some other scripts.

So, I use the ":scriptnames" command and get the following results:

 
  1: /etc/vimrc
  2: /usr/share/vim/vimfiles/archlinux.vim
  3: ~/.vimrc
  4: ~/.vim/colors/badwolf.vim
  5: /usr/share/vim/vim74/syntax/syntax.vim
  6: /usr/share/vim/vim74/syntax/synload.vim
  7: /usr/share/vim/vim74/syntax/syncolor.vim
  8: /usr/share/vim/vim74/filetype.vim
  9: /usr/share/vim/vimfiles/ftdetect/conkyrc.vim
 10: /usr/share/vim/vim74/indent.vim
 11: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 12: /usr/share/vim/vim74/plugin/gzip.vim
 13: /usr/share/vim/vim74/plugin/matchparen.vim
 14: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 15: /usr/share/vim/vim74/plugin/rrhelper.vim
 16: /usr/share/vim/vim74/plugin/spellfile.vim
 17: /usr/share/vim/vim74/plugin/tarPlugin.vim
 18: /usr/share/vim/vim74/plugin/tohtml.vim
 19: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 20: /usr/share/vim/vim74/plugin/zipPlugin.vim

Could it be that one of these plugins or files are overriding my ~/.vimrc file?

Last edited by azurepancake (2014-09-27 16:55:19)

Offline

#2 2014-09-27 06:32:11

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Setting Up VIM Colorscheme

I don't think any of these should interfere with ~/.vimrc.

One thing you can try is to remove all the settings from your .vimrc except the colorscheme one, and see if you can reproduce the problem.

Offline

#3 2014-09-27 07:15:22

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: Setting Up VIM Colorscheme

Instead of syntax enable, try syntax on .

From /usr/share/vim/vim74/doc/syntax.txt, vim command :help syntax

The ":syntax enable" command will keep your current color settings.  This     
allows using ":highlight" commands to set your preferred colors before or     
after using this command.  If you want Vim to overrule your settings with the 
defaults, use:                                                               
        :syntax on

Offline

#4 2014-09-27 15:12:55

azurepancake
Member
Registered: 2009-01-19
Posts: 42

Re: Setting Up VIM Colorscheme

Thanks for the assistance all.

I tried what you both recommended, I simplified my .vimrc file and switched the "syntax" to "on". However, I am unfortunately still running into the issue.

I shrunk my .vimrc to the following:

colorscheme badwolf
syntax on

I then loaded my generic "/etc/profile" in VIM. I took a screenshot so that you can see how it looks by default when it loads a file: http://i.imgur.com/omI4cUp.jpg?1

And then I ran ":colorscheme badwolf" in VIM command mode and it loads like so: http://i.imgur.com/XxvXEFS.jpg?1

Very strange.. And to make it even more interesting, if I create a new file (instead of editing an existing one) and I run ":colorscheme badwolf", it will change only a few things like the background color, but syntax colors do not occur. See this image of an arbitrary script I created with VIM for an example: http://i.imgur.com/rsXXkU1.jpg?1

Now if I close this file I created, reopen it and run the colorscheme command, all the extra syntax colors now are active! See image: http://i.imgur.com/6OXZikc.jpg?1

I'm really confused by all of this..

Last edited by azurepancake (2014-09-27 15:15:33)

Offline

#5 2014-09-27 18:27:38

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: Setting Up VIM Colorscheme

Basic stripped .vimrc

set nocompatible
filetype plugin on
syntax on
colorscheme darkblue

Vim won't use syntax highlighting on a new, unnamed file – the filetype cannot be known. You can set the filetype for your shell script with the Vim command, :set filetype=sh or, shortened, :se ft=sh.

Another way, maybe easier, after you have written the shebang line, save the file and have Vim re-read it by using the :e command with no arguments.

A third way to get syntax highlighting started: start a new vim session using a filename with an extension that Vim recognizes. If 'new.sh' does not exist, the following command will tell Vim to use shell syntax highlighting.

$ vim new.sh

Offline

Board footer

Powered by FluxBB