.vimrc:2: command not found: colorscheme
Asked Answered
H

4

6

I'm trying to change the color scheme on my vim editor.

I put this on the .vimrc file

set t_Co=256
colorscheme molokai

I have the molokai.vim file on .vim/colors

And when I try to load the .vimrc file with the source command (on Mac OS X) I get this error

.vimrc:2: command not found: colorscheme

Could you help me?

Hollenbeck answered 4/9, 2014 at 3:58 Comment(1)
I was trying to run source .vimrc and @paxdiablo told me that this will not work. So finally, I didn't and I add a line to my .vimrc and it works! My file .vimrc finished is set t_Co=256 syntax enable colorscheme molokaiHollenbeck
H
13

It appears that you're "loading" the .vimrc file by trying to run it within a shell. Because that's the sort of message you'll get if you try to execute it, with something like:

./.vimrc

or:

source .vimrc

(most shells having a set command so they're unlikely to complain about that first line).

That's not how the .vimrc file is processed, vim itself will process the file as it starts up.

All you need to do is edit the file (and save it of course) then, the next time you start a vim session, it will pick up the changes.

Heady answered 4/9, 2014 at 4:5 Comment(4)
@navamario, you don't source it, vim itself loads it when you run the editor - see the update.Heady
But when I open vim I can`t see the colors of molokai.vimHollenbeck
@navamario, that's a totally different issue, worthy of a different question. This particular error is because you're trying to source a file that's not a valid bash script. Run a vim session then enter :color and see what it prints at the bottom of the screen. If it's default (or something other than molokai), then it's not being picked up. If that's the case, ask a new question.Heady
Thank you for your help, you are right... when I run :color on vim I get molokai. So the issue is another different.Hollenbeck
F
1

The correct command for colorscheme is color molokai. Try that instead of colorscheme molokai.

Fluted answered 4/9, 2014 at 4:2 Comment(1)
The correct command is colorscheme, which may be abbreviated to as little as colo.Heady
N
1

An issue I found is that on some Debian Distros, only vim-tiny is installed, which is a light weight version of vim and is missing a lot of functionality.

Try running

sudo apt-get install vim-gui-common
sudo apt-get install vim-runtime
Nester answered 14/8, 2018 at 13:12 Comment(0)
P
0

Try :help colorscheme in vim, or :colo[rscheme]

Pedropedrotti answered 4/9, 2014 at 4:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.