Open-source project
chrisbra/csv.vim avatar
chrisbra/csv.vim

csv.vim turns a Vim buffer into a spreadsheet with column sums, folds and fixed width support

A Filetype plugin for csv files

1,319 stars66 forksVim ScriptVim

At a glance

What is it?
A Vim filetype plugin for column separated data that adds column aware movement, aggregate functions, vertical folding and delimiter handling to a plain buffer. It works in Vimscript inside the editor, which is both its strength and the limit of what it can do to a large file.
Who is it for?
Adopt csv.vim if you edit CSV data inside Vim every day and want column aware movement, quick sums and dynamic filters without leaving the buffer. Do not adopt it as a replacement for a real data tool when the file is large, because every operation runs as Vimscript over the buffer and the documentation has a section dedicated to size and performance.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 86 days ago.
What is it written in?
Mainly Vim Script, according to GitHub's language statistics.

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

Editorial analysis

A filetype plugin, not a mode

csv.vim is a Vim filetype plugin for column separated data. The README describes the target format broadly: files that are usually called CSV and use a comma, though sometimes the delimiter is a pipe or a semicolon, and fixed width columns also exist. The plugin exists to make those files workable in Vim rather than to replace a spreadsheet.

The implementation is the conventional Vim layout, visible in the repository root. There is an `ftplugin/` directory holding the main script, a `ftdetect/` directory for file detection, a `syntax/` directory, a `plugin/` directory, `autoload/` for the functions and `doc/` for the help file, plus a `Makefile` and a `CHANGELOG.md`. The Makefile builds a vimball for distribution and extracts the version from the `Version:` line in the filetype script.

Detection is by extension and the default recognises `*.csv` and `*.dat` as the CSV filetype. The plugin was heavily influenced by the Vim Wiki Tip667, though the README notes it works differently. That lineage matters for judging the design.

The result is that the plugin loads only for the filetype it targets, and everything it offers is a normal Vim command or function you can call from a mapping, a command line or a script.

Column movement, and the E remapping you will want to change

The everyday value of a CSV plugin is moving around a wide row without counting characters. csv.vim provides commands for going to the previous and next column, and it does something that will annoy some users: by default it remaps `E` to go back to the previous column.

The README is candid that the `E` choice is not the best option, since it would be logical to use `B` for that instead, and that you can set your favourite key by setting a variable in your config. The documentation has a dedicated section on mapping `B` instead of `E`, and the same advice appears in the built in help.

The reason to change it is that `E` in normal mode already means go to the end of the word, and overriding it changes behaviour for every buffer of that filetype. On a wide CSV where columns contain long text, `E` is genuinely useful, so the default is a real trade-off rather than a mistake.

The other column commands cover the things a spreadsheet does with a column: what column the cursor is in, how many columns a row has, searching within a column, highlighting a column, arranging a column, unarranging it, and deleting it. There is also a check for duplicate records, which is the kind of one liner that saves a manual pass over a data file.

Aggregate functions sum, count, max, min and average a column

The plugin exposes a set of functions that compute over a column, and they are the part that turns this from a convenience into a data tool.

vim
CSVSum(col, fmt, startline, endline)
CSVCount(col, fmt, startline, endline[, distinct])
CSVMax(col, fmt, startline, endline)
CSVMin(col, fmt, startline, endline)
CSVAvg(col, fmt, startline, endline)

The shape is consistent. You name the column, give a format, and optionally bound the range with a start and end line. The count function takes an extra argument for counting distinct values, which is the kind of detail that shows the author used these on real data. The format argument is what lets a number be printed the way you want rather than as Vim's default representation.

The README also lists a sum of numbers in a row, a maximum and minimum value of a column, an average, a variance and a standard deviation, so the range of statistics is broader than the five functions above. There is a section on defining custom aggregate functions for anything not built in, which is a good sign about the design of the function layer.

The catch is that these are Vimscript functions reading the buffer. They are perfectly good for a file that fits comfortably in memory and awkward for one that does not, and the documentation includes a section on size and performance considerations and another titled Slow CSV plugin that addresses exactly this.

Configuration covers delimiter, strict columns, concealment and fixed width

The configuration surface is broad, and it is where the plugin earns its keep on files that are not clean comma separated values.

The delimiter is configurable, which is the first thing to set for pipe or semicolon separated data. Tab delimited files use the `vartabs` feature of Vim for tab stop handling, so tabs and columns are a supported case rather than an accident.

Strict columns is a mode for files where every row has the same number of fields, and the plugin can highlight the column automatically, conceal content, and handle newlines inside quoted fields. The header lines setting lets the plugin know how many leading lines are headers so they are excluded from data operations, which is what makes the aggregate functions return the number you expect on a file with a title row. There is also a number format setting, a comment character setting, and a setting for moving folded lines.

Fixed width columns get their own treatment, with both a manual setup and a setup using a wizard. A wizard in a terminal editor is unusual and worth noticing, because it suggests the fixed width case is common enough in practice to deserve guided setup rather than a config snippet you have to derive yourself.

One configuration item is a general Vim setting rather than a plugin one: `:filetype plugin on` in your `.vimrc`. The README points out that the plugin needs `ftplugins` enabled for Vim to detect CSV files automatically, and for the native Vim 8 pack feature installation, `:helptags` must be run to generate the help tags.

Folding, transposing and turning a buffer into a table

Several of the commands work on the shape of the data rather than on a single column, and these are the ones that feel most like a spreadsheet.

Vertical folding folds the buffer by column, so you see one column at a time with the rest collapsed behind it. This is a genuinely useful view for a wide file with many columns, and it is implemented with Vim's folding mechanism rather than with a separate display mode.

Transposing a column turns a column of values into a row, and transforming into a table reshapes the buffer into an aligned table layout. Adding new empty columns extends every row with blank fields, which is the operation you need before a new data source is merged in.

Substituting in columns applies a substitution across one column or a set of columns, and counting values inside a column gives a frequency table for that column, which is the quickest way to find the categories in a data set without leaving the editor.

An analyze a column command is also listed, along with dynamic filters, which let you narrow the visible rows by a condition and then work on the filtered set. The file operations covered by the README include copy column, move a column, and file and directory diffing is not part of this plugin, so comparison work stays outside.

Taken together these are the operations that make csv.vim more than a movement aid, and they are the reason someone would keep it installed for years rather than weeks.

Installation: a plugin manager, the pack feature, or copying files

The plugin follows the standard runtime path structure, so it installs the way any Vim plugin does. The README lists a table of plugin managers with the exact command for each.

vim
call vam#ActivateAddons([ 'csv' ])

That is the VAM entry. The other supported managers each have their own one liner, including Pathogen, NeoBundle, Vundle, Plug, Dein and minpac. The Pathogen entry is a git clone into `~/.vim/bundle/csv` followed by `:Helptags`, and the native Vim 8 pack feature entry is a git clone into `~/.vim/pack/dist/start/csv` followed by `:helptags`.

Manual installation means copying all the files into your `~/.vim` directory. The README explains that for Vim to detect CSV files automatically you need `ftplugins` enabled, which is the line `:filetype plugin on` in your `.vimrc`, and that on Unix the user runtime directory is typically `~/.vim` while on Windows it is usually `~/vimfiles`. The `:echo expand("~")` command tells you what Vim considers your user directory, which is the check to run when the detection is not working.

The documentation also has a troubleshooting section for a syntax error when opening a CSV file, which is the symptom of the filetype not being enabled correctly, and one for an autocommand on opening and closing files if you want to run something around the buffer.

Maintenance, licence and the size limit in the documentation

The repository is not archived and the last push was on 2026-07-30. There are no GitHub releases for it, so versioning happens through the `Version:` line in the filetype script and the CHANGELOG, with the Makefile incrementing the version and the last change date with a one line Perl substitution as part of the release target. The homepage is the Vim script page on vim.org.

The licence is the Vim licence.

The honest limit is performance. The documentation has a section on size and performance considerations and a section on a Slow CSV plugin, and the reason is structural rather than a missing optimisation. Every column function walks the buffer in Vimscript, and every view that folds or transposes a column rewrites lines. On a very large file it becomes the bottleneck, and the answer is to move the data to a tool built for it and come back with the result. A plugin that keeps the file in the editor buffer cannot avoid that ceiling, and the documentation being honest about it is a mark of quality.

For a Vim user, that ceiling is exactly why the plugin is still worth having. The work it replaces is clicking through a spreadsheet application, and for the size of file where that is a real annoyance, the plugin wins.

Editorial conclusion

Adopt csv.vim if you edit CSV data inside Vim every day and want column aware movement, quick sums and dynamic filters without leaving the buffer. Do not adopt it as a replacement for a real data tool when the file is large, because every operation runs as Vimscript over the buffer and the documentation has a section dedicated to size and performance. Verify first that :filetype plugin on is in your config so the filetype is detected, that your delimiter is set correctly before running a column function, and that the remapping of E to move to the previous column does not collide with a habit you have from normal mode.

Frequently asked questions

How do I install csv.vim in Vim?

The plugin follows the standard runtime path structure and can be installed with plugin managers such as Pathogen, NeoBundle, Vundle, VAM, Plug, Dein and minpac, or with the native Vim 8 pack feature. Manual installation means copying the files into your ~/.vim directory.

Why does csv.vim not detect my CSV files?

Vim needs ftplugins enabled for the filetype to load, so put :filetype plugin on in your .vimrc. The README also covers a syntax error when opening a CSV file as a symptom of the filetype plugin not being enabled.

How do I change the delimiter in csv.vim?

The delimiter is a configuration setting, so set it in your config before running column commands. The plugin is built for comma separated files but also supports pipe or semicolon delimiters and fixed width columns.

How do I sum or count values in a column with csv.vim?

Use the CSVSum, CSVCount, CSVMax, CSVMin and CSVAvg functions, each taking a column, a format and optional start and end line arguments. CSVCount also takes a distinct flag, and the plugin supports custom aggregate functions.

Does csv.vim remap keys in normal mode?

Yes. By default it remaps E to go back to the previous column, and the README notes it would be more logical to use B. You can set your preferred key with a variable in your config, following the section on mapping B instead of E.

Official sources

  1. chrisbra/csv.vim on GitHub
  2. Issues
  3. License: Vim
  4. Project website
  5. README
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/chrisbra-csv-vim.svg)](https://hysenlabs.com/projects/chrisbra-csv-vim)

Was this useful?