sponsor Vim development Vim logo Vim Book Ad

csv.vim : A Filetype plugin for csv files.

 script karma  Rating 402/149, Downloaded by 7245    Comments, bugs, improvements  Vim wiki

created by
Christian Brabandt
script type
This plugin is used for handling column separated data with Vim. Usually those
files are called csv files and use the ',' as delimiter, though sometimes they
use e.g. the '|' or ';' as delimiter and there also exists fixedwidth columns.
The aim of this plugin is to ease handling these kinds of files.              
This is a filetype plugin for CSV files. It was heavily influenced by          
the Vim Wiki Tip667 (http://vim.wikia.com/wiki/VimTip667), though it          
works differently.

Also you can create ascii tables using :Table

For a screenshot, of  how the plugin can be used, see

Please vote for the plugin, if you like it!

This little filetype plugin allows among others:
-  Display on which column the cursor is as well as number of columns
-  Search for text within a column using :SearchInColumn command
-  Highlight the column on which the cursor is using :HiColumn command
-  Visually arrange all columns using :ArrangeColumn command
-  Delete a Column using :DeleteColumn command
-  Display a vertical or horizontal header line using :Header or :VHeader command
-  Sort a Column using :Sort command
-  Copy Column to register using :Column command
-  Move a column behind another column using :MoveCol command
-  Calculate the Sum of all values within a column using :SumCol command (you can also define your
    own custom aggregate functions)
-  Move through the columns using the normal mode commands
    (W forwards, H backwards, K upwards, J downwards)
-  sets up a nice syntax highlighting, concealing the delimiter, if your Vim supports it
-  dynamic filtering (Press enter on a value and all other lines, that don't have this value in this column
    will be folded away. Press enter on another value and this value will be ANDed to the filter list. Press
    Backspace to delete the last item from the filter list. Press Space to fold all lines, that have the same value
    in the current field, Press Enter to fold all lines, that have a different value in the current field.
    Use :Filters to see what filters are actvie)
-  Analyze all values of a column (distribution) using :Analyze command
-  Insert new records, using :NewRecord command
-  Implement a wizard to setup fixed-width CSV files using :CSVFixed
-  Hide certain columns, using :VertFold
-   :Table to create ascii type tables (this function is available as plugin for all filetypes)

Please read the help on how to use the plugin
:h ft-csv.txt
install details
Open csv.vmb in Vim and source the file:

:so %

This will install the plugin into your $HOME/.vim/ftplugin directory and the documentation into your $HOME/.vim/doc directory.

See also the help for installing Vimball-Archives (:h vimball-intro)

Take a look at :h ft-csv.txt for the documenation
and read :h csv-installation to have vim automatically detect csv-files.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
csv-0.31.vmb 31 2015-01-15 7.4 Christian Brabandt - fix that H on the very first cell, results in an endless loop (https://github.com/chrisbra/csv.vim/issues/31, reported by lahvak, thanks!)
- fix that count for |AddColumn| did not work (according to the documentation) (https://github.com/chrisbra/csv.vim/issues/32, reported by lahvak, thanks!)
- invalid reference to a WarningMsg() function
- WhatColumn! error, if the first line did not contain as many fields as the line to check.
- Rename |:Table| command to |:CSVTable| ( https://github.com/chrisbra/csv.vim/issues/33, reported by Peter Jaros, thanks!)
- Mention to escape special characters when manually specifying the delimiter. https://github.com/chrisbra/csv.vim/issues/35), also detect '^' as delimiter.
- Csv fixed with columns better use '\%v' to match columns, otherwise, one could get problems with multibyte chars
- Sorting should work better with csv fixed with patterns (could generate an inavlide pattern before)
- Refactor GetSID() (provided by Ingo Karkat https://github.com/chrisbra/csv.vim/pull/37, thanks!)
- New public function |CSVSum()|
- Restrict |csv-arrange-autocmd| to specific file sizes (suggested by Spencer Boucher in https://github.com/chrisbra/csv.vim/issues/39, thanks!)
- Make |:CSVSearchInColumn| wrap pattern in '%\(..\)' pairs, so it works correctly with '\|' atoms
- Small improvements on |:CSVTable| and |:NewDelimiter| command
- <Up> and <Down> should skip folds (like in normal Vi mode, suggested by
  Kamaraju Kusuma, thanks!)
(automatically uploaded)
csv-0.30.vmb 30 2014-03-27 7.3 Christian Brabandt - |:CSVSubstitute| should substitute all matches in a column, when 'g' flag is given
- Don't override 'fdt' setting (https://github.com/chrisbra/csv.vim/issues/18, reported by Noah Frederick, thanks!)
- Consistent Commands naming (https://github.com/chrisbra/csv.vim/issues/19, reported by Noah Frederick, thanks!)
- New Function |CSVField()| and |CSVCol()|
- clean up function did not remove certain buffer local variables, possible error when calling Menu function to disable CSV menu
- make |:CSVArrangeColumn| do not output the numer of substitutions happened (suggested by Caylan Larson, thanks!)
- better cleaning up on exit, if Header windows were used
- Let |:CSVVHeader| accept a number, of how many columns to show (suggested by Caylan Larson, thanks!)
- better error-handling for |CSVFixed|
- selection of inner/outer text objects  was wrong, reported by Ingo Karkat, thanks!)
- errors, when using |:CSVAnalyze| and there were empty attributes
- allow to left-align columns when using |:CSVArrangeColumn|
- |SumCol_CSV| did not detect negative values
- make <cr> in (Virtual-) Replace work as documented
(automatically uploaded)
csv-0.29.vmb 29 2013-08-14 7.3 Christian Brabandt -setup |QuitPre| autocommand to quit cleanly in newer vims when using :Header and :VHeader
- new |AddColumn_CSV| command
- prevent mapping of keys, if g:csv_nomap_<keyname> is set
  (reported by ping)
- new |Substitute_CSV| command
- better syntax highlighting
- small speedup for |ArrangeColumn_CSV|
- 'E' did not correctly move the the previous column
- support for vim-airline added
(automatically uploaded)
csv-0.28.vmb 28 2012-12-14 7.3 Christian Brabandt new command :Table to create ascii tables for non-csv files (this feature is available as plugin (for all filetypes)
(automatically uploaded)
csv-0.27.vmb 27 2012-11-21 7.3 Christian Brabandt - Better |CSV-Tabularize|
- Documentation update
(automatically uploaded)
csv-0.26.vmb 26 2012-07-25 7.3 Christian Brabandt - Better handling of setting filetype specific options
- |CSV-Tabularize|
- fix some small errors
(automatically uploaded)
csv-0.25.vmb 25 2012-05-17 7.3 Christian Brabandt - |SearchInColumn_CSV| should match non-greedily, patch by Matěj Korvas,
- better argument parsing for |SearchInColumn_CSV|, patch by Matěj Korvas,
(automatically uploaded)
csv-0.24.vmb 24 2012-04-12 7.3 Christian Brabandt - Allow to transpose the file (|csv-transpose|, suggested by Karan Mistry, thanks!)
- |DeleteColumn_CSV| allows to specify a search pattern and all matching
  columns will be deleted (suggested by Karan Mistry, thanks!)
(automatically uploaded)
csv-0.23.vmb 23 2012-03-25 7.3 Christian Brabandt - Don't error out, when creating a new file and syntax highlighting script can't find the delimiter (ftplugin will still give a warning, so)
- Don't pollute the search register when loading a file
- Give Warning when number format is wrong
- Don't source ftdetect several times (patch by Zhao Cai, thanks!)
- |NewDelimiter_CSV| to change the delimiter of the file
- |Duplicate_CSV| to check for duplicate records in the file
- Issue https://github.com/chrisbra/csv.vim/issues/13 fixed (missing quote, reported by y, thanks!)
- |CSVPat()| function
- 'lz' does not work with |:silent| |:s| (patch by Sergey Khorev, thanks!)
- support comments (|csv_comment|, suggested by Peng Yu, thanks!)
(automatically uploaded)
csv-0.22.vmb 22 2011-11-08 7.3 Christian Brabandt - Small enhancements to |SumCol_CSV|
- :Filters! reapplys the dynamic filter
- Apply |csv-aggregate-functions| only to those values, that are not folded away.
- |SumCol_CSV| can use a different number format (suggested by James Cole, thanks! (also |csv-nrformat|
- Documentation updates (suggested by James Cole and Peng Yu)
- More code cleanup and error handling
  https://github.com/chrisbra/csv.vim/issues/9 reported Daniel Carl, thanks!
  https://github.com/chrisbra/csv.vim/issues/8 patch by Daniel Carl, thanks!
- New Command |NewRecord_CSV| (suggest by James Cole, thanks!)
- new textobjects InnerField (if) and outerField (af) which contain the field without or with the delimiter (suggested by James Cole, thanks!)
- |csv-arrange-autocmd| to let Vim automatically visually arrange the columns using |ArrangeColumn_CSV|
- |csv-move-folds| let Vim move folded lines to the end
- implement a Menu for graphical Vim
(automatically uploaded)
csv-0.21.vmb 21 2011-10-06 7.3 Christian Brabandt - Implement a wizard for initializing fixed-width columns (|CSVFixed|)
- Vertical folding (|VertFold_CSV|)
- fix plugin indentation (by Daniel Karl, thanks!)
- fixed missing bang parameter for HiColumn function (by Daniel Karl, thanks!)
- fixed broken autodection of delimiter (reported by Peng Yu, thanks!)
(automatically uploaded)
csv-0.19.vmb 19 2011-09-26 7.3 Christian Brabandt - Make |:ArrangeColumn| more robust
- Link CSVDelimiter to the Conceal highlighting group for Vims that have
  +conceal feature (suggested by John Orr, thanks!)
- allow the possibility to return the Column name in the statusline |csv-stl|
  (suggested by John Orr, thanks!)
- documentation updates
- Allow to dynamically add Filters, see |csv-filter|
- Also display what filters are active, see |:Filter|
- Analyze a column for the distribution of a value |csv-analyze|
- Implement UnArrangeColumn command |UnArrangeColumn_CSV|
  (suggested by Daniel Karl in https://github.com/chrisbra/csv.vim/issues/7)
(automatically uploaded)
csv-0.18.vmb 18 2011-08-30 7.3 Christian Brabandt - fix small typos in documentation
- document, that 'K' and 'J' have been remapped and the originial function is
  available as \K and \J
- Delimiters should not be highlighted within a column, only when used
  as actual delimiters (suggested by Peng Yu, thanks!)
- Performance improvements for |:ArrangeColumn|
(automatically uploaded)
csv-0.17.vba 17 2011-08-16 7.3 Christian Brabandt - small cosmetic changes
- small documentation updates
- fold away changelog in help file
- Document, that |DeleteColumn_CSV| deletes the column on which the cursor
  is, if no column number has been specified
- Support csv fixed width columns (|csv-fixedwidth|)
- Support to interactively convert your csv file to a different
  format (|csv-convert|)
(automatically uploaded)
csv-0.16.vba 16 2011-07-25 7.3 Christian Brabandt -Sort on the range, specified (reported by Peng Yu, thanks!)
-|MoveCol_CSV| to move a column behind another column
(suggested by Peng Yu, thanks!)
-Document how to use custom functions with a column
-Use g:csv_highlight_column variable, to have Vim automatically
highlight the column on which the cursor is (|csv-hicol|)
-Header/VHeader command should work better now (|Header_CSV|,
-Use setreg() for setting the register for the |Column_CSV|
command and make sure it is blockwise.
-Release 0.14 was not correctly uploaded to vim.org
(automatically uploaded)
csv-0.13.vba 13 2011-03-14 7.3 Christian Brabandt
-documentation update
-https://github.com/chrisbra/csv.vim/issues#issue/2 thanks lespea!
-https://github.com/chrisbra/csv.vim/issues#issue/3 thanks lespea!
-https://github.com/chrisbra/csv.vim/issues#issue/1 thanks lespea!
-fix some small annoying bugs
-WhatColumn! displays column name
(automatically uploaded)
csv-0.12.vba 12 2011-02-24 7.2 Christian Brabandt -don't use :noa when switching between windows
-make sure, colwidth() doesn't throw an error
(automatically uploaded)
csv-0.11.vba 11 2011-02-24 7.2 Christian Brabandt -new command :Column
-:SearchInColumn did not find anything in the last if no delimiter was given (reported by chroyer)
-:VHeader displays the first column as Header similar to how :Header works
-:HeaderToggle and VHeaderToggle commands that toggles displaying the header lines/columns
(automatically uploaded)
csv-0.10.vba 10 2011-02-23 7.2 Christian Brabandt -Only conceal real delimiters
-document g:csv_no_conceal variable
-document g:csv_nl variable
-document conceal feature and syntax highlighting
-Normal mode command <Up>/<Down> work like K/J
-More robust regular expression engine, that can
also handle newlines inside quoted strings.
-Slightly adjusted syntax highlighting
(automatically uploaded)
csv-0.9.vba 9 2011-02-19 7.2 Christian Brabandt -use conceal char depending on encoding
-Map normal mode keys also for visual/select and operator pending mode
(automatically uploaded)
csv-0.8.vba 8 2011-02-17 7.2 Christian Brabandt -Better Error handling
-HiColumn! removes highlighting
-Enable NrColumns, that was deactivated in v.0.7
-a ColorScheme autocommand makes sure, that the syntax highlighting is reapplied, after changing the colorscheme.
-small performance improvements for |ArrangeColumn_CSV|
-Syntax Highlighting conceales delimiter
-A lot more documentation
-SearchInColumn now searches in the current column, if no column has been specified
(automatically uploaded)
csv-0.7.vba 7 2011-02-16 7.2 Christian Brabandt -Make the motion commands 'W' and 'E' work more reliable
-Document how to setup filetype plugins
-Make |WhatColumn_CSV| work more reliable (report from http://vim.wikia.com/Script:3280)
-DeleteColumn deletes current column, if no argument given
-|ArrangeColumn_CSV| handles errors better
-Code cleanup
-Syntax highlighting
-'H' and 'L' move forward/backwards between csv fields
-'K' and 'J' move upwards/downwards within the same column
-|Sort_CSV| to sort on a certain column
-|csv-tips| on how to colorize the statusline
(automatically uploaded)
csv-0.6.vba 6 2011-02-15 7.2 Christian Brabandt -Make |ArrangeColumn| work more reliable (had problems with multibyte chars before)
-Add |Header| function
-'W' and 'E' move forward/backwards between csv fields
(automatically uploaded)
csv.vba 0.5 2010-04-20 7.0 Christian Brabandt enabled GLVS (see :h GLVS),
put cvs.vim on a public repository available at http://github.com/chrisbra/csv.vim
csv.vba 0.4a 2010-03-11 7.0 Christian Brabandt fixed documentation
csv.vba 0.4 2010-03-11 7.0 Christian Brabandt Better error handling
added :InitCSV to reinitialize the plugin
:HiColumn now by default the current column, if no argument is given
csv.vba 0.3 2009-10-28 7.2 Christian Brabandt Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo