toggle-corp / alacritty-colorscheme

Change colorscheme of alacritty with ease.
Apache License 2.0
343 stars 35 forks source link

Failed to synchronise neovim with alacritty #14

Closed djtsorrell closed 3 years ago

djtsorrell commented 3 years ago

I believe I have followed the steps in the readme correctly, but neovim is still not using alacritty's settings. I have cloned the aaron-williamson-alacritty-theme repo into my home directory. alacritty-colorscheme -C ~/.aaron-williamson-alacritty-theme/colors/ -a base16-gruvbox-dark-hard-256.yml works as expected. However, when adding the -V option to the last command, neovim states the following errors:

Error detected while processing /home/dominic/.vimrc_background:
line    2:
E185: Cannot find color scheme 'base16-gruvbox-dark-hard-256'
Error detected while processing function lightline#update[5]..lightline#colorscheme[12]..lightl
ine#highlight:
line   18:
E421: Colour name or number not recognised: ctermfg= ctermbg= term=bold cterm=bold gui=bold
Error detected while processing function lightline#update:
line    5:
E171: Missing :endif

I have installed neovim-remote and I have also added the following to my init.vim:

if filereadable(expand("~/.vimrc_background"))
  let base16colorspace=256          " Remove this line if not necessary
  source ~/.vimrc_background
endif

and these lines to my .bashrc:

function reload_nvim {
    for SERVER in $(nvr --serverlist); do
        nvr -cc "source ~/.config/nvim/init.vim" --servername $SERVER &
    done
}

COLOR_DIR="$HOME/.aaron-williamson-alacritty-theme/colors"
LIGHT_COLOR='base16-gruvbox-light-soft.yml'
DARK_COLOR='base16-gruvbox-dark-soft.yml'

alias day="alacritty-colorscheme -C $COLOR_DIR -a $LIGHT_COLOR -V && reload_nvim"
alias night="alacritty-colorscheme -C $COLOR_DIR -a $DARK_COLOR -V && reload_nvim"

The day/night snippets are not working, unfortunately.

tnagorra commented 3 years ago

Looks like the vim cannot find the colorscheme. Have you installed the vim plugin that provides the base16 colorscheme for vim?

If not, here's the link for the plugin: https://github.com/chriskempson/base16-vim

Can you provide further information on the day/night snippets not working?

djtsorrell commented 3 years ago

I've now installed the base16 plugin. I've re-run the alacritty-colorscheme command with the -V option and now I get the following error in neovim:

Error detected while processing /home/dominic/.vimrc_background:
line    2:
E185: Cannot find color scheme 'base16-gruvbox-dark-hard-256'

Which, I suppose, means that errors 421 and 171 are now fixed. As for the day/night snippets, I'm not sure if I'm using them correctly but I type 'day' into the terminal and told that the command 'day' is not found. It then gives me come similarly spelt package names and a prompt to install them.

tnagorra commented 3 years ago

Alacritty reads the theme from base16-alacritty. Vim reads the theme from base16-vim.

Seems like base16-vim doesn't have base16-gruvbox-dark-hard-256 colorscheme.

EDIT: The colorscheme base16-gruvbox-dark-hard works for me!

djtsorrell commented 3 years ago

I can confirm that base16-gruvbox-dark-hard works as expected. This has also fixed the day/night snippets. I did need to install the base16 shell. I should also point out to posterity that one should not set a colour scheme for the lightline vim plugin. This caused errors when setting a colour scheme via alacritty-colorscheme.

If I may ask one more question, @tnagorra , why does the terminal opacity change when I open neovim? I have alacritty set to 0.9 opacity in my config, but when I open neovim, the terminal becomes fully opaque. Is the just something built into neovim?

tnagorra commented 3 years ago

Yay! that it's working. But, It's weird that you had to install base16 shell for it to work.

@djtsorrell I have no idea about the opacity as I always have an opaque terminal. EDIT: This works for me https://github.com/miyakogi/seiya.vim

djtsorrell commented 3 years ago

Seiya.vim works perfectly. Thank you for all your help. It's strange that the 256 colour schemes don't work, but oh well.