sonph / onehalf

Clean, vibrant and pleasing color schemes for Vim, Sublime Text, iTerm, gnome-terminal and more.
MIT License
1.78k stars 236 forks source link

the Colors are not being sourced automatically when i use colorscheme onehalfdark #104

Closed smc181002 closed 3 years ago

smc181002 commented 3 years ago

hello guys, I am new to Vim and Neovim so forgive me if I didn't something wrong. So the issue is, I am using neovim and I also use Plug for package management when I installed it with Plug 'sonph/onehalf', {'rtp': 'vim' } as mentioned in the docs. but when I add cursorline onehalfdark to the init.vim file and then I run the command source % to apply the changes and it did work. Then after when I closed the file and opened it again, it gave the error image

Error detected while processing /root/.config/nvim/init.vim:
line   29:
E185: Cannot find color scheme 'onehalfdark'
Press ENTER or type command to continue

Now I found a solution but it is not an ideal as I think. what I did was to source the onehalfdark.vim file inside the init.vim file. image

Now this did work but it isn't ideal 🤔 so please look into it because I loved the theme and this is a minus 😞 But if there is an error I made, please point it out 🙏

k2s09 commented 3 years ago

Remove all lines in which you manually tried to install it. Just use Vim-Plug. You have written the Vim-Plug syntax correctly. Make sure you write syntax on and colorscheme onehalfdark under the block for plugins. Then close init.vim using :wq, open it again, do these in order

:source %
:PlugInstall
:UpdateRemotePlugins
:q
:q!

When you open vim the next time, your theme should be present.

sonph commented 3 years ago

Sorry for the late reply, I think you might have solved it by now :)

But as @k2s09 said you need to put the colorscheme onehalfdark command below the block for plugins. Statements are executed in order so you need to define the plugins for them to be sourced properly before calling colorscheme. Basically I'd put line 29 below 37 (end of plugins block).

Cheers!