Open-source project
mechatroner/rainbow_csv avatar
mechatroner/rainbow_csv

Rainbow CSV: column highlighting and SQL-like queries inside Vim

Rainbow CSV - Vim plugin: Highlight columns in CSV and TSV files and run queries in SQL-like language

722 stars32 forksPythonMIT

At a glance

What is it?
Rainbow CSV is a Vim plugin that paints CSV and TSV columns in distinct colours, describes the field under the cursor, and adds RBQL, a lightweight SQL-like query language for slicing tabular text in the buffer. The core is pure vimscript, and the query engine is a separate component.
Who is it for?
Rainbow CSV fits someone who lives in Vim, opens a CSV or TSV regularly and wants column structure visible, field inspection, a lint for row shape, and ad hoc table queries without leaving the buffer or starting a database. It does not fit a Python-first workflow that already leans on pandas for anything beyond reading rows.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 13 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Colouring columns is the feature, but the field inspector is what people use

Rainbow CSV is a Vim plugin whose headline is a rainbow of colours across the columns of a CSV or TSV file, but the README lists a set of features that read like a small data tool rather than a colouriser. There is the column highlighting, a description of the column under the cursor, RBQL queries in a SQL-like language, a consistency check for CSV files, alignment and shrinking of fields by adding or removing trailing spaces, and cell-level cursor navigation. The audience is obvious once you see those: anyone who lives in Vim and keeps needing to look at a delimited file, from a log to an export to a dataset someone sent over. The plugin is invoked through commands rather than modes, and everything happens inside the buffer, which is the appeal. There is no server, no index and no daemon between the file and the answer.

Seven built-in filetypes and a dialect policy for each

Rainbow CSV ships seven built-in CSV filetypes, each mapped to a separator and a policy describing extra properties such as whether the separator can be escaped inside a double quoted field. The built-in list covers csv with a comma where the separator is ignored inside double quoted fields, tsv with a tab, csv_semicolon, csv_whitespace where consecutive whitespaces are merged, csv_pipe, and two RFC variants, rfc_csv and rfc_semicolon, which behave like their plain counterparts but allow multiline fields. The README also mentions an infinite number of autogenerated filetypes, because when you run :RainbowDelim or :RainbowMultiDelim and pick a separator that does not map to a built-in one, the plugin writes a filetype syntax file into its syntax folder on the fly. The consequence for users is that a dialect you invent once is remembered, and the policy table is the spec you consult when a file parses strangely.

Four ways to tell the plugin what your delimiter is

The README lists four routes to enabled highlighting, and the order of preference tells you how much work the autodetector usually saves you. First, automatic detection based on file content and or extension, which handles most CSV tables you open in Vim. Second, a manual delimiter selection with :RainbowDelim, where the character under the cursor becomes the separator and the choice is saved in a config file for future sessions. Third, :RainbowMultiDelim for multi-character separators, selected in visual mode, for example a sequence such as ~#~. Fourth, explicitly activating one of the built-in filetypes with :set ft=csv. If you would rather not rely on autodetection, the README shows how extensions can be bound to a dialect in your .vimrc:

bash
autocmd BufNewFile,BufRead *.csv   set filetype=csv_semicolon
autocmd BufNewFile,BufRead *.dat   set filetype=csv_pipe

The plugin also pushes the idea further than tables: you can highlight records in log files, one-line XML, other delimited records, or even function arguments in your own source code, using a comma or comma-plus-whitespace as the delimiter, and :NoRainbowDelim turns the colouring off again.

RBQL is a query language for the buffer, not a database

The built-in query engine is called RBQL and described as a lightweight SQL-like query language. A query is run either with the :Select command, for example :Select a1, a2, or by entering :RainbowQuery, which opens a query editing mode. The demo in the README is a screencast, and it notes that the expressions in that demo were Python, while JavaScript is also available. That detail is the one to sit with: RBQL evaluates expressions against the rows of the buffer, so a query is closer to a spreadsheet formula applied to a table than to a SQL statement sent anywhere. The repository layout reflects the split, with a separate rbql_core directory holding the query engine and a plugin directory for the Vim side, which is also why the releases carry two version numbers, the plugin version and an RBQL version.

Multiline fields need the RFC dialects and sometimes a syntax resync

A CSV file with double quoted fields spanning several lines is rare and genuinely awkward, and the README has a dedicated section for it. The fix is to set the filetype to rfc_csv or rfc_semicolon, for instance with :set ft=rfc_csv, both of which are fully compatible with RFC 4180 and are named after that memo. The catch the README flags is that syntax highlighting for those two dialects can drift out of sync with the file content, in which case the :syntax sync fromstart command brings it back. The good news is that the two dialects are fully supported by RBQL, which among other things lets you convert them to line-by-line CSV by replacing the newlines inside fields with a run of four spaces. That is exactly the kind of repair that is painful to do by hand and is the strongest argument for having the plugin rather than a text editor alone.

CSVLint checks row shape, and alignment fixes ragged fields

The consistency check, invoked with :CSVLint, tests two things: the consistency of double quote usage across CSV rows, and the consistency of the number of fields per row. That is a small linter for the two mistakes that actually break a spreadsheet import, and it is the sort of check that a generic text editor will never run for you. The alignment command :RainbowAlign addresses the other common annoyance, padding or trimming trailing spaces so the fields line up, and the cell-level navigation commands :RainbowCellGoUp, :RainbowCellGoDown, :RainbowCellGoLeft and :RainbowCellGoRight move the cursor by field rather than by character, which is what you want in a wide table. Comments are handled separately: by default the plugin does not highlight comments in CSV files, and :RainbowComment marks the character under the cursor as the comment prefix, with :RainbowCommentMulti for a multi-character prefix and :NoRainbowComment to disable it for one file.

Pure vimscript core, but the last tagged release is old

The core functionality of the plugin is written in pure vimscript with no additional libraries required, and the README says it works out of the box after installation through a package manager, listing Vundle, VimPlug and dein as the supported routes. The repository layout backs that up, with autoload, plugin, syntax, doc, test and the rbql_core directory at the top level. Maintenance is where the picture gets uneven. The recent releases are 4.3.0, tagged alongside RBQL 0.10.0, on 2019-11-12, 4.2.0 with multi-line field and record support on 2019-08-11, and 4.1.0 with multicharacter separators on 2019-07-28. The last push to the repository was on 2026-10-11, so commits are still landing, but the newest tagged release is years older than that, and the README does not document a release process for the newer work. Anyone installing today should read the untagged commits as the real state of the plugin, and the licence is MIT with a LICENSE file at the root.

Editorial conclusion

Rainbow CSV fits someone who lives in Vim, opens a CSV or TSV regularly and wants column structure visible, field inspection, a lint for row shape, and ad hoc table queries without leaving the buffer or starting a database. It does not fit a Python-first workflow that already leans on pandas for anything beyond reading rows. Before installing it, try it on a real file and check the dialect detection on your own exports, since autodetection is content based, and note that the query engine and the plugin are versioned separately, with the newest tagged plugin release dating from 2019.

Frequently asked questions

How do I install Rainbow CSV in Vim?

The README says to use your favourite package manager, listing Vundle, VimPlug and dein as the supported routes, and states that no additional steps are required because the plugin works out of the box.

What is RBQL and how do I run a query?

RBQL is the built-in lightweight SQL-like query language. You run a query with the :Select command, for example :Select a1, a2, or open :RainbowQuery to enter query editing mode, and the expressions evaluated against the rows can be written in Python or JavaScript.

How do I handle CSV files with multi-line fields?

Set the filetype to rfc_csv or rfc_semicolon, both compatible with RFC 4180, for instance with :set ft=rfc_csv. If the syntax highlighting drifts out of sync with the file content, use the :syntax sync fromstart command.

What does :CSVLint check?

The linter checks the consistency of double quote usage across CSV rows and the consistency of the number of fields per row. Alignment is a separate command, :RainbowAlign, which adds or removes trailing spaces in fields.

Official sources

  1. Issues
  2. License: MIT
  3. mechatroner/rainbow_csv on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/mechatroner-rainbow-csv.svg)](https://hysenlabs.com/projects/mechatroner-rainbow-csv)

Was this useful?