2

I have installed embark using vim-plug. I have put it inside my vimrc. But everytime I open vim, it shows this error

Error detected while processing /home/pial/.vim/vimrc:
line    9:
E185: Cannot find color scheme 'embark'
Press ENTER or type command to continue

But, when I am inside vim, and then use the command mode to select embark as my colorscheme, then it works.

My .vimrc file:

autocmd! bufwritepost vimrc ++nested source %


" change leader key to <space>, previously it was <alt>
let mapleader = " "


" colorscheme
colorscheme embark

" setting linenumbers and relative line numbers
set nu rnu

" incremental searching for vim
set incsearch

" shows command in the status bar
set showcmd

" Plugins installed using vim-plug
call plug#begin('~/.vim/plugged')

Plug 'embark-theme/vim', { 'as': 'embark' }

call plug#end()

I am using VIm 8.1 and my OS is Ubuntu 20.04.

3

You need to reorder the commands in your vimrc, to only set the colorscheme after the plug#end() call.

call plug#begin('~/.vim/plugged')
Plug 'embark-theme/vim', { 'as': 'embark' }
call plug#end()

colorscheme embark

The reason why this is important is that plug#end() is what will modify the 'runtimepath' setting, which is what allows Vim to find plug-in files in directories where those plug-ins reside. Since the colorscheme is coming from a plug-in managed by vim-plug, you need that to be set up first, before it's actually available.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.