Vim Tips Wiki


Revision as of 04:29, March 13, 2014 by Monking (Talk | contribs)

1,619pages on
this wiki

Use this page to discuss script 2830 csv: filetype plugin for csv files

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.


How do I uninstall this plugin?

Open the csv*.vmb file with your vim and type :RmVimball %. That should uninstall the plugin. See also the help :h :RmVimball. Chrisbra 21:49, March 13, 2012 (UTC)

Sort request

When sorting it would be nice to avoid sorting the header row(s).

:2,nSort! 3

I tried the above but it not seem to work as expected. Doh! Just realised that the following was what I need to use:

:2,$Sort! 3

Excuse the Vim newbie!

No problem. If you have questions, it might be better to ask me directly, cause I might not notice if something changes here Chrisbra 09:17, September 16, 2011 (UTC)

Bug report

I see a bug. With the following csv file:


If the cursor is on the "3", command ":WhatColumn" gives 0. I'd expect it to give 3.

It would also be nice to have a setting where highlighting follows the current column when moving the cursor with something like this:

au CursorMoved * HiColumn

--Preceding unsigned comment added by Dominiko 19:32, July 25, 2010

No idea about the plugin, but you do know that CSV works well? In the CSV tip, we decided against having the column highlighting change when you simply moved the cursor elsewhere because it's handy to keep track of what column you were last "interested" in (I think). Anyway, if you haven't tried it, give it a go and let me know what you think. JohnBeckett 10:38, July 26, 2010 (UTC)
Thanks, for pointing it out. I must admit, the script's RE does probably not always work best. But I see, how I can fix it. Chrisbra 17:25, July 28, 2010 (UTC)
Please try the version from github. That should have fixed it. Chrisbra 10:04, February 16, 2011 (UTC)


Hello, i really like your CSV script. One possible improvment could be a 'Column Header'. Like the command 'Header' freezes the first line, such a command could freeze the first column.

Some CSV is like:

  • item,1,2,3
  • stuff1,12,35,46
  • stuff2,12,35,46
  • stuff3,12,35,46
  • stuff4,12,35,46


This is harder than it sounds. First you could only have one Header, either horizontally or vertically. So you can't use both at the same time. Second the column can be different wide. So one needs to define the optimal width.
Let me see, what I can do. Chrisbra 22:26, February 23, 2011 (UTC)
Please try version 0.11. That adds an :VHeader command.
regards, Chrisbra 20:40, February 24, 2011 (UTC)

Bug report

The column colo(u)rs are corrupt.

To get black and grey backgrounds to the columns, one must write:

" here ctermbg is the BACKGROUND colour for the EVEN columns
" here ctermbg is the FOREGROUND colour for the ODD  columns
autocmd Filetype csv hi CSVColumnEven   ctermfg=white       ctermbg=darkgray
autocmd Filetype csv hi CSVColumnOdd    ctermfg=black       ctermbg=white

in their vimrc file

I can't see why the colors are corrupt. The default color for CSVColumnEven is already defined like this. If you want to change the default color for CSVColumnOdd, put this in your .vimrc :hi CSVColumnOdd ctermfg=black ctermbg=white. This is also explained in the help below :h csv-syntax Chrisbra 11:10, April 4, 2012 (UTC)

Bug report

E315: ml_get: invalid line number

Going to the last line causes the above error. CSV specific highlighting disappears. Other functionality is unaffected. Videokunst Sun Jul 29 15:07:23 CEST 2012

I don't see that error, but it looks like a Vim bug. What Version of Vim are you using? Have you set any of the csv specific options? I possibly need a sample file, with which you see the error.
If so, which ones? You might want to file a bug at the github page, so I can better track down this error. Chrisbra (talk) 11:58, August 5, 2012 (UTC)
In fact it is a confirmed Vim bug. I'm using Vim 7.3. Videokunst Sun Aug 5 22:43:47 CEST 2012

Replace text in highlighted column

Maybe a new functionality request, if it can be done now please let me know. I'm trying to replace value A in particular column by value B. Normally I would use vertical visual select and :'<,'>s/\%VA/B/g . If the csv plugin is able to highlight particular column, it may be able to replace A->B in highlighted fields. --Tpolak (talk) 10:02, July 24, 2012 (UTC)

You should be able to use :SearchInColumn /pat/ and then you can use :%s//Value B/ That should already do. You might need to do the :s/ call several times, if the value A happens to be in that particular column several times. By the way, you might want to email feature requests directly to me or use the bugtracker at, because I don't watch this page regularly. Chrisbra (talk) 14:05, July 26, 2012 (UTC)

Highlight row

The :HiColumn is useful, and it seems like there also should be a way to highlight a given row. Is there a way to do it already that I simply lack the vim-fu to intuit?

How about using cursorline? Try :set cursorline Is this what you want? Chrisbra (talk) 12:32, October 27, 2012 (UTC)

SumColumn in Expressions

I'm trying to sum columns 2 and 3, up to the current line, with (Insert Mode) <C-R>=call('SumCol',[getline(2,line('.'))])+call('SumCol',[getline(3,line('.'))]). I get "E117: Unknown function: SumCol". Is there a way to use SumCol inside an expression? --Monking (talk) 04:29, March 13, 2014 (UTC)

Around Wikia's network

Random Wiki