1

I just upgraded Vim to version 9.1 (under Windows). Seems now it improved the display of csv files, commas are shown as vertical lines (|), and the columns are displayed alternatively as yellow and cyan background.

Is there a way to change the coloring?

For example, I have csv files with many columns, so I would like to have 10 colors for columns to rotate.

1 Answer 1

1

I can't reproduce the behavior you mention without a plugin.

The csv.vim plugin provides the behavior you describe in the introduction of your question.

enter image description here

This plugin use only four colors (two for the header and two for the body):

hi CSVDelimiter guifg=#616E88 guibg=#2E3440

hi CSVColumnEven guifg=#D8DEE9 guibg=#434c5e
hi CSVColumnOdd guifg=#D8DEE9 guibg=#2E3440

hi CSVColumnHeaderEven guifg=#D8DEE9 guibg=#434c5e
hi CSVColumnHeaderOdd guifg=#D8DEE9 guibg=#2E3440

The rainbow_csv plugin provide the behavior you would like to have.

enter image description here

This plugin use an arbitrary number of colors (I use ten):

let g:rcsv_colorpairs = [
  \ ['magenta', '#B48EAD'],
  \ ['red', '#BF616A'],
  \ ['lightred', '#D08770'],
  \ ['yellow', '#EBCB8B'],
  \ ['green', '#A3BE8C'],
  \ ['cyan', '#8FBCBB'],
  \ ['lightblue', '#88C0D0'],
  \ ['blue', '#5E81AC'],
  \ ['grey', '#616E88'],
  \ ['NONE', 'NONE']
  \ ]
1
  • 1
    I did install some csv plugins in vim 8 but they didn't work. Now it seems somehow some started working in vim9. Let me check.
    – athos
    Commented Apr 9 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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