mechatroner / rainbow_csv

🌈Rainbow CSV - Vim plugin: Highlight columns in CSV and TSV files and run queries in SQL-like language
MIT License
626 stars 22 forks source link

[bug] change colorscheme will make color disappear #30

Closed Freed-Wu closed 3 years ago

Freed-Wu commented 3 years ago
" $ uname -r
" 5.13.10-arch1-1
" $ has nvim
" ✓ nvim 0.5.0
" $ has python
" ✓ python 3.9.6
" $ cat test.vim
set runtimepath=$VIMRUNTIME
set runtimepath+=~/.local/share/nvim/repos/github.com/mechatroner/rainbow_csv
autocmd VimEnter * colorscheme default
" $ vi -u test.vim a.csv

The color will disappear.

I guess it maybe should add some code like

autocmd! colorscheme * call some_function_render_csv()

Thanks!

mechatroner commented 3 years ago

Thank you for the bug report! Interestingly I can reproduce it only if I have g:rcsv_colorpairs customization var initialized. Also adding the colorscheme autocmd as you suggested didn't resolve the issue, I also had to add vimenter autocmd, sometimes Vim is just weird. But in the end, it worked, see my latest patch. BTW why are you using autocmd VimEnter * colorscheme default and not just colorscheme default?

Freed-Wu commented 3 years ago

I have tested your patch and it really solves this bug. Thanks for your effort!

About autocmd VimEnter, this is because in fact, I colorscheme default after vi -u test.vim a.csv, then the color of csv disappears. So I copy this line to test.vim by adding autocmd VimEnter to ensure colorscheme default in correct time.