"syntax/synload.vim (Line 19)" Cannot find color scheme while saving the .vimrc file

375 views
Skip to first unread message

Marslo Jiao

unread,
Sep 16, 2014, 7:04:41 AM9/16/14
to vim...@googlegroups.com
Because of some reason, the .vimrc file and .vim folder has been saved in the specified location:
- .vimrc: ~/.marslo/.vimrc
- .vim: ~/.marslo/.vim/
- colorscheme is marslo256.vim (made by myself): ~/.marslo/.vim/bundle/marslo.vim/colors/marslo256.vim

I found that, the Error as blow will show EVERYTIME while .vimrc saving:
```
Error detected while processing /root/.marslo/myprograms/vim74/share/vim/vim74/syntax/synload.vim:
line 19:
E185: Cannot find color scheme 'marslo256'
Press ENTER or type command to continue
```

In My .vimrc file, there's a command would be executed in every .vimrc saving for autoloading the change of vimrc:
```
autocmd! bufwritepost $HOME/.marslo/.vimrc source %
```

And I also checked the Line 19 in syntax/synload.vim:
```
17 " Set the default highlighting colors. Use a color scheme if specified.
18 if exists("colors_name")
19 ¦ exe "colors " . colors_name
20 else
21 ¦ runtime! syntax/syncolor.vim
22 endif
```

Then, I tried analyzed the `startuptime` for launching `.vimrc` file, the "startuptime" file can be found at: https://github.com/Marslo/test/blob/master/vimrc_startuptime. Something wired, because "/root/.marslo/myprograms/vim74/share/vim/vim74/syntax/syncolor.vim" file has been launched FOUR TIMES (l18, l38, l39, l40) !!! WHY ???
Never mind, because of there NOTHING wrong while start .vimrc at first time.

I just want to know why the error shows in everytime saving vimrc (autocmd + exe).

------------
- My vimrc file: https://github.com/Marslo/VimConfig/blob/master/Configurations/vimrc_PublicEnv
- My colorscheme file (marslo256.vim): https://github.com/Marslo/marslo.vim/blob/8c6dc141b3a7ff4ac99d39e26704bb53a9b68a23/colors/marslo256.vim

Marslo Jiao

unread,
Sep 16, 2014, 7:28:14 AM9/16/14
to vim...@googlegroups.com
On Tuesday, 16 September 2014 19:04:41 UTC+8, Marslo Jiao wrote:
> Because of some reason, the .vimrc file and .vim folder has been saved in the
> ....

Okay, If adding "silent!" in `autocmd!`, the error would be disabled:
```
autocmd! bufwritepost $HOME/.marslo/.vimrc silent! source %
```

But I still want to know why the error shows.

Ben Fritz

unread,
Sep 16, 2014, 7:56:56 AM9/16/14
to vim...@googlegroups.com
On Tuesday, September 16, 2014 6:04:41 AM UTC-5, Marslo Jiao wrote:
> Because of some reason, the .vimrc file and .vim folder has been saved in the specified location:
> - .vimrc: ~/.marslo/.vimrc
> - .vim: ~/.marslo/.vim/
> - colorscheme is marslo256.vim (made by myself): ~/.marslo/.vim/bundle/marslo.vim/colors/marslo256.vim
>

This is a non-standard setup. I assume you have a plugin manager (Pathogen?) to
let you use the 'bundle' directory, and I further assume you set it up as
directed by the plugin installation instructions; but why is your entire setup
in an extra directory under $HOME? How did you get that into your runtimepath?

(Nevermind, I finally noticed your .vimrc link at the bottom, the extra
directory seems to come from your "portable" settings which look pretty clever).

> I found that, the Error as blow will show EVERYTIME while .vimrc saving:
> ```
> Error detected while processing /root/.marslo/myprograms/vim74/share/vim/vim74/syntax/synload.vim:
> line 19:
> E185: Cannot find color scheme 'marslo256'
> Press ENTER or type command to continue
> ```
>
> In My .vimrc file, there's a command would be executed in every .vimrc saving for autoloading the change of vimrc:
> ```
> autocmd! bufwritepost $HOME/.marslo/.vimrc source %
> ```

To me this indicates maybe your runtimepath is not set up correctly. I'm not
sure what Pathogen or other plugin managers do when you tell them to use a
specific bundle directory and they are already using that directory. I don't
know where in your .vimrc you set the colorscheme, whether your plugin
manager is fully initialized beforehand or not, or whether syntax or filetype
detection is already enabled before the command runs the first time.

>
> And I also checked the Line 19 in syntax/synload.vim:
> ```
> 17 " Set the default highlighting colors. Use a color scheme if specified.
> 18 if exists("colors_name")
> 19 ¦ exe "colors " . colors_name
> 20 else
> 21 ¦ runtime! syntax/syncolor.vim
> 22 endif
> ```

Perhaps when this script runs, the runtimepath has not been fully set up yet?
The first time it runs (on launching Vim) g:colors_name would not be set yet
because you have not yet set a colorscheme. But subsequent launches would see
the previous value. Your autocmd could unlet that variable prior to sourcing the
.vimrc if this is the root cause.

>
> Then, I tried analyzed the `startuptime` for launching `.vimrc` file, the
> "startuptime" file can be found at:
> https://github.com/Marslo/test/blob/master/vimrc_startuptime. Something wired,
> because "/root/.marslo/myprograms/vim74/share/vim/vim74/syntax/syncolor.vim"
> file has been launched FOUR TIMES (l18, l38, l39, l40) !!! WHY ???
>
> Never mind, because of there NOTHING wrong while start .vimrc at first time.
>

Where does startuptime come into this discussion? Or are you asking a new
question now? Your problem was just when sourcing .vimrc after launching Vim
already correct?

It is interesting that the script gets sourced multiple times. This is likely
due to changing colorschemes or applying a syntax or something. I'm not sure of
the exact reasons this script would be sourced, but I know it is not abnormal to
source a few of the runtime scripts on multiple occasions.

> I just want to know why the error shows in everytime saving vimrc (autocmd + exe).
>
> ------------
> - My vimrc file: https://github.com/Marslo/VimConfig/blob/master/Configurations/vimrc_PublicEnv
> - My colorscheme file (marslo256.vim): https://github.com/Marslo/marslo.vim/blob/8c6dc141b3a7ff4ac99d39e26704bb53a9b68a23/colors/marslo256.vim

Oops, I didn't notice you posted your .vimrc!

It looks like one of my assumptions were correct, you're using both Pathogen
*and* Vundle. Ok, I guess that would *probably* work fine.

But it also looks like they're not installed per the instructions. You start by
turning on filetype and indent detection, and syntax highlighting, and then you
turn it off again. THEN you set up both your plugin managers. I think you're
supposed to set up your plugin managers prior to turning on filetype detection
or syntax.

I suspect the filetype commands and the syntax command may be sourcing
syncolor.vim. If that is the case, since these commands come before your
runtimepath is set up, your colorscheme won't be found.

First, I would try re-arranging your .vimrc so the Vundle/Pathogen setup comes
earlier; almost at the top. Probably right after you initialize your
runtimepath.

If that doesn't solve the problem, then as a workaround, try my other
suggestion, using :unlet g:colors_name in your autocmd prior to sourcing your
.vimrc.

Marslo Jiao

unread,
Sep 18, 2014, 3:51:33 AM9/18/14
to vim...@googlegroups.com
On Tuesday, 16 September 2014 19:56:56 UTC+8, Ben Fritz wrote:
> .....

> But it also looks like they're not installed per the instructions. You start by
> turning on filetype and indent detection, and syntax highlighting, and then you
> turn it off again. THEN you set up both your plugin managers. I think you're
> supposed to set up your plugin managers prior to turning on filetype detection
> or syntax.

Hi Ben,

You are correct!!
The error message are GONE when I moved `syntax` setting after `vundle` ended!!!!! That means, this error was triggered by *Line 19 in my vimrc* (https://github.com/Marslo/VimConfig/blob/94ed40791777d230ff53309c9c275791f3c9df1a/Configurations/vimrc_PublicEnv#L19)

What I did is:
- Move the *Line 19* (https://github.com/Marslo/VimConfig/blob/94ed40791777d230ff53309c9c275791f3c9df1a/Configurations/vimrc_PublicEnv#L19) to the end of `vundle` stuff (https://github.com/Marslo/VimConfig/blob/186ce94d1c30c3ee0477ac62907e5b682b78ad40/Configurations/vimrc_PublicEnv#L99)
- Remove the `filetype plugin indent on` in Line 20, because this setting duplicated with Line 96 (End of vundle stuff)

And Everything just FINE!!
Thanks a lot!!!

I've asked this question in StackExchange -> Superuser (http://superuser.com/questions/806602/e185-cannot-find-color-scheme-for-synload-vim-line-19?noredirect=1#comment1054351_806602), One guy lost himself in entangled with my specified runtimepath....
Finally, this problem has been fixed.... Thank you bloody much !!!!! :)

Marslo Jiao

unread,
Sep 18, 2014, 3:58:28 AM9/18/14
to vim...@googlegroups.com
On Tuesday, 16 September 2014 19:56:56 UTC+8, Ben Fritz wrote:
>
> Where does startuptime come into this discussion? Or are you asking a new
> question now? Your problem was just when sourcing .vimrc after launching Vim
> already correct?
>

The reason is, I tried to debug the process while the vimrc saving, means "it was `sourced` in vimrc -> color has been `executed`(exe "colors " . colors_name) in synload.vim".
But, I don't know can I get the log file, so I tired to using the startuptime log file to analysis it.

And, something wired is, the error cannot be shown at the first time startup ($ vim ~/.vimrc), but it will be shows in everytime saving itself (source %)

Nevermind, this problem has been fixed already, :) Just let you know the reason of analyzed the startuptime log file.

Reply all
Reply to author
Forward
0 new messages