E185: Cannot find color scheme* - vim

I have been customizing my vimrc file but for some reason, no colorschemes work. Whenever I try to change the colorscheme, it just gives me:
E185: Cannot find color scheme '*'
I checked the color folder to make sure I actually have colors and I do. For example the first item in the color folder is blue.vim but when I put colorscheme blue in the vimrc, it just gives
E185: Cannot find color scheme 'blue'
when I start Vim and the colorscheme doesn't apply. I also tried changing the colorscheme from within Vim and it also returns the same error. All the other vimrc settings that I've tried work so far.

For those using Plug as plugin manager, the problem may be solved by setting the color scheme after declaring the plugin that provides the theme:
call plug#begin()
Plug 'rakr/vim-one' " tell Vim to load the theme/plugin
call plug#end()
colorscheme one " set the color scheme after the theme provider has been loaded

This sounds like a problem with your 'runtimepath' option. If you use a plugin manager, these usually extend that. The default location should be ~/.vim/colors. Please check with
:set runtimepath?
There should be a ~/.vim in there (or equivalent).
If all else fails, you could also just :source /full/path/to/your/color.vim

For me it worked by removing the extension from the colorscheme file.
Try to rename blue.vim to blue.

I recently had this error. The problem in my case was that the name of the colorscheme in the file was different from the file name. Renaming the colorscheme in the file fixed it for me.
In COLOR1.vim:
let g:colors_name = "COLOR2"
Changing to:
let g:colors_name = "COLOR1"
fixed the problem.
I assume that changing the file name would also fix this.

This may also be due to entries/artifacts in your configuration files (~/.vimrc,system vimrc), or if you use the "vim -u ..." command line option to point to a custom configuration file.
The artifacts could be something like:
set rtp -=$HOME/.vimrc
set rtp -=$HOME/.vimrc/after
set runtimepath -= $HOME/.vimrc
...etc...
If you find these entries in your configuration files, then comment them out to see if the error goes away.
These are often entries in test configurations of vim to be used only in special instances. If you used such a test configuration file as the template for your routine vim configuration, then they are likely uneccessary.

Related

Different color in Vim while using screen

I'm currently using color scheme from http://vimcolors.com/535/jay/dark in iTerm on Mac OSX. However, I found the color became different when I use Vim in screen, what setting should I look into here?
Without screen:
With screen:
> echo $TERM
xterm-256color
> cat ~/.screenrc
...
term xterm-256color
I hope it isn't too late.
Normally, on your ~/.vimrc there might be a line
colorscheme yourColorScheme
where yourColorScheme is one of the .vim color configuration file your can find in /usr/share/vim/vim80/colors/, without the .vim extension
Example, I want to use /usr/share/vim/vim80/colors/blue.vim configuration file, I do
colorscheme blue
If this line isn't written in .vimrc, then vim will select a default color configuration file and that selection might be different while using screen.
I had the same problem and solve it by adding this line à the end of the file.
The only distasteful thing is that you will probably have to try all the configuration listed in /usr/share/vim/vim80/colors/ to find the one you liked (I advise you to open a terminal with your ~/.vimrc opened in to test the differents colorshemes, a second terminal where you vim a file that shows you the good syntax color you like, and a third and a third where you launch screen and vim the same file to see the new syntax color and compare)

Vim keyboard shortcuts changed, how to revert to normal?

I used to use ctrl+left/right to navigate between words (I know I'm supposed to use b/e etc in vim, but...). But starting today, ctrl+left/right deletes the next 4 lines! I tried disabling my plugins one by one, but it didn't help. I also have triple checked my vimrc file -- nothing there.
Where else are vim key mappings defined? Is there any plugin that can cause this behaviour? The only recent change that I have made has been changing my colour scheme to Solarized.
Thanks
Edit: I found the cause. It's a line I have added to .bashrc to have 256 colors. The line is export TERM="screen-256color-bce" . I still don't know how to correct it (aside from removing the line)
:verbose map will show you all mappings and also where they were set from.
If you only want to see maps for specific mode (like normal, input, or visual), use :verbose nmap, :verbose imap, or :verbose vmap.
This also may be not because of Vim, but because of terminal application. Did you change therminal or its settings recently?
The problem was because of a line I have added to .bashrc to have 256 colors in vim. The line is export TERM="screen-256color-bce". I removed that line and instead added set t_Co=256 to .vimrc before setting colorscheme. Now vim uses 256 colors and the key mappings work properly.

Vim colorscheme behaviour different when loading from vimrc / spf13

I'm trying to load a default colorscheme torte by placing colorscheme torte on my ~/.vimrc.local (I'm using vIm SPF13 by the way if it means anything.)
Anyways, whenever I open vim, I end up seeing this.
But when I execute colorscheme torte from the command mode, I get
Anyone knows how to get the second image consistent? Thanks. :)
My guess is that 'background' is changed at some point or another of the startup process which would explain the difference in looks. You can test it with:
:set background=light
:set background=dark
But the arbitrary and unneeded complexity introduced by your distribution makes it hard to guess where it's done or not.
I'm assuming that you're deliberately not adding color scheme to your .vimrc file.
If that is true, simply add this to your .vimrc file
if filereadable(glob("~/.vimrc.local")
source ~/.vimrc.local
endif
Otherwise simply add it to your. vimrc file itself.

Can you remove default color schemes from vim in a vimrc?

I've reduced the number of custom color schemes in vim to the bare minimum of great ones, but I still have all of the crazy defaults, like elflord, which I'd rather not have to tab through. Can I remove these without hacking my MacVim install and having to do it in the next update?
Obviously this is splitting hairs, but configuring my .vimrc in the first place is splitting hairs.
tmcw,
My installation of vim73 has the colors stored in \path\to\vim\vim73\colors.
In there I see elflord.vim and a host of other files.
Presumably removing them from this directory should remove them altogether.
Then, you can just tab through whatever you want.
Edit: If you want to have something that goes in and removes the files from the colors directory after an update, perhaps you may have to write a script to manage that--I'm not really sure.
HTH
I presume you are tabbing through your colorschemes for editing different filetypes? why not just set up your colorscheme preference in corresponding filetype-specific entries using autocmd FileType or via individual vim files in the ftplugin directory. Make sure you have filetype plugin on
How many colorschemes do you actually use? If it's just a few (and you really need to change them frequently, like whether it's dark or bright daylight), I'd define shortcut commands, like:
command -bar Col1 colorscheme default
command -bar Col2 colorscheme darkblue
You could remove the colorschemes from $VIMRUNTIME/colors/, but you're right about having to do this after every Vim upgrade.
A (complex) alternative would be writing a custom :Colorscheme command, with a custom completion that uses something like a blacklist to suppress certain schemes. As a bonus, with the cmdalias plugin, you could even overwrite the original :colorscheme command, to make this fully transparent.

Solarized theme on Vim + Terminator + Ubuntu 11.10

I am trying to setup solarized theme for vim on Terminator but it is not working. :-(
I was successfully able to setup solarized for terminator but it just doesn't seem to work for vim. Here is what my .vimrc looks like
call pathogen#infect()
filetype plugin indent on
syntax enable
set background=dark
"set t_Co=16
"let g:solarized_termcolors=16
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized
$TERM is set to xterm
I have also tried it with the two lines above uncommented but still not working.
Could someone please tell me what I am doing wrong?
Thanks!
Edit:
As Ethan Schoonover pointed out in his vim colorscheme readme, to make the colorscheme work first you have to configure your terminal colour palette.
In terminator there is a github repo that holds the colour configuration for the dark and light scheme.
The problem is that that palette isn't right either :P, the correct one is the one a guy posted in an issue on that same repo.
The correct configuration is the following (at least for the dark scheme):
[[solarized-dark]]
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
cursor_color = "#eee8d5"
foreground_color = "#eee8d5"
background_color = "#002b36"
After that, you have to configure the solarized colorscheme:
syntax on
set t_Co=16
set background=dark
colorscheme solarized
A couple of things to have in mind:
Normally, the set t_Co=16 line is not necessary because most terminal emulators only support 16 colours (terminator for example). But I rather be explicit than implicit (specially if you are going to sync your files between multiple computers).
The line set g:solarized_termcolors=16 is the default, so you can put it or not: it won't make any difference.
In my experience the 256 colour version is better (I like more grey background over a blue one; but that's personal taste :P). Contrary to what everyone could think, the 256 colour scheme is actually the 'fallback' being the 16 one the default. Yeah, weird, most people would think that 256 > 16. Anyway, to use the 'fallback' you have to change the lines to the following:
set t_Co=256
set g:solarized_termcolors=256
There are actually some issues with colour output in other CLI applications, I suggest you to go and read Seebi article about dircolors and an ongoing(?) discussion on the solarized github issue tracker.
Pretty sure you don't need the vim color theme import, since you already set up the color scheme for terminator. At least, that was the only way I could get it to play nice after lots of trial and error.
Here's a screenshot of my vimrc, from vim, within terminator:
As you can see, I haven't got the line
colorscheme solarized
So you could try taking that out - it finally seems to be working for me!
ps your screenshot doesn't look like it was taken from within terminator - unless we are talking about different terminators, of course.
Try adding this to your .vimrc file
let g:solarized_termcolors=16
The rest of the settings in the screenshot are fine.

Resources