dylanaraps / pywal

🎨 Generate and change color-schemes on the fly.
MIT License
8.23k stars 313 forks source link

vim lightline with pywal #615

Closed j0ker70 closed 2 years ago

j0ker70 commented 2 years ago

I have already added the wal.vim plugin for vim. But I alse use lightline. How can I customize lightline to work with pywal?

I have added this in my .vimrc.

" statusline with lightline
set laststatus=2
let g:lightline = {
      \ 'colorscheme': 'wal',
      \ }

But this shows too many errors. What can I do?

alt-romes commented 2 years ago

Are you using macOS ? I fixed this by using vim 8.2 installed probably by xcode-select --install on Big Sur (/usr/bin/vim) I also had a workaround for it before using the system installed vim, which I might recreate to share if your problem still persists (originally inspired by following some issues starting here https://github.com/dylanaraps/wal.vim/issues/5)

j0ker70 commented 2 years ago

No, I am using Ubuntu 20.04. and I am using vim 8.1. I installed it from apt package manager. The errors are like this:

Error detected while processing function lightline#update[5]..lightline#colorscheme[12]..lightline#highlight:
line 18:
E254: Cannot allocate color guibg=
Error detected while processing function lightline#update:
line 5:
E171: Missing endif
alt-romes commented 2 years ago

If it were me, I'd try to upgrade vim first, because after I solved lightline's errors, I noticed some highlighting was incorrect (e.g. LineNr, NonText), and decided it would be better to attempt using another stable 8.2 release (perhaps if I had been able to also fix wal.vim's colorscheme highlighting I would have kept the slightly more recent vim ¯_(ツ)_/¯)

However, I did get lightline working, with the following changes (see full file here):

Screenshot 2021-08-29 at 11 13 25
j0ker70 commented 2 years ago

Sorry if this sounds like a really stupid question but I don't know how to apply these changes. Can you tell me how can I?

alt-romes commented 2 years ago

You need to find where "wal.vim" plugin is installed, it should be a folder called wal.vim, probably somewhere around inside the folder .vim. Inside wal.vim there's a file with path autoload/airline/themes/wal.vim

You can try running this command to search for it

cd ~/.vim && find . -name "wal.vim" | grep autoload/airline/themes/wal.vim

You want to replace that file with the one I provided in that gist.

This one line should find and automatically replace it:

cd ~/.vim && (curl -L "https://gist.githubusercontent.com/alt-romes/8a5084d09252965c0a383783ca1dcdad/raw/36cc7e516beb994c1bc1268e10a001689d8a5423/(errors%2520workaround)%2520wal.vim" > "$(find . -name "wal.vim" | grep autoload/lightline/colorscheme/wal.vim)")

Or the less cryptic, equivalent, following three lines:

cd ~/.vim
curl -L "https://gist.githubusercontent.com/alt-romes/8a5084d09252965c0a383783ca1dcdad/raw/36cc7e516beb994c1bc1268e10a001689d8a5423/(errors%2520workaround)%2520wal.vim" > new-wal.vim
cat new-wal.vim > "$(find . -name "wal.vim" | grep autoload/lightline/colorscheme/wal.vim)"
rm new-wal.vim
j0ker70 commented 2 years ago

It's working now. Thank you. I would install Vim 8.2 asap.