Idea For Syntax Highlighting for CSV Files
I may be one of the weird ones here where I find myself sometimes preferring to edit CSV files in a text editor. If the CSV file is small or simple enough, it can be a fair bit quicker to work in than opening a file in a table editor1. But I’ve never come across a text editor that has made this easy. Some of them give you the option to switch to a built-in table editor, but these are usually feature poor compared to text editing capabilities the application has (which makes sense, given that we are talking about text editors).
So I can see some benefit of text editors adding some form of “syntax highlighting” for CSV files. Much like how syntax highlighting works for source code, this would be geared towards making it easier to see the table structure of CSV data while preserving the overall textual nature of the file itself.
Some ideas I have for how such syntax highlighting could work:
- Highlighting the column in which the carat is currently located
- Make the header row fix in the editor, such that it always appears on top. Also highlight the current column header in a prominent manner (e.g. bold)
- Reduce the prominence of the characters used for separation and quotation.
Here’s a mockup:
Note that this list doesn’t include things like aligning the columns as if it was a table. While that would be nice — provided that it’s still possible to enter text as you would normally — I don’t think it’s wholly necessary. The same would go for things like changing the key bindings to make it easier to work with column data2. Again, nice to have, but unnecessary.
No, the goal here is to have all the features of editing CSV data as the text format that it is, while making it easier to see the table structure that the format encodes. Syntax highlighting works well for other textual formats in this regard, and I think it could also help here.
-
Yes, you can open it in a spreadsheet, but… no. I’ve never liked editing CSV files in spreadsheets. They just seem to heavyweight for the types of edit I need to do. And they require excessive use of the mouse, which slows me down. ↩︎
-
Some ideas for that: changing Option+Arrow Keys to move between columns, and adding keybindings for easily creating new columns to the left or right of the current column. ↩︎