Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to work with csv files in vim

Tags:

I want csv file to be opened in vim in the same way it opens in microsoft office . Data should be in column format and commas should not be seen and its should be traversed easily. Is it possible in vim with help of any plug-ins?

like image 478
vaichidrewar Avatar asked Mar 01 '11 09:03

vaichidrewar


People also ask

How do I create a CSV file in vim?

To create a CSV file with a text editor, first choose your favorite text editor, such as Notepad or vim, and open a new file. Then enter the text data you want the file to contain, separating each value with a comma and each row with a new line.

How do I run a CSV file?

If you already have Microsoft Excel installed, just double-click a CSV file to open it in Excel. After double-clicking the file, you may see a prompt asking which program you want to open it with. Select Microsoft Excel. If you are already in Microsoft Excel, you can choose File > Open and select the CSV file.

What is CSV file format?

A CSV is a comma-separated values file, which allows data to be saved in a tabular format. CSVs look like a garden-variety spreadsheet but with a . csv extension. CSV files can be used with most any spreadsheet program, such as Microsoft Excel or Google Spreadsheets.


1 Answers

I am probably a little bit later answering that question, but for completeness I'll answer anyway. I have made the csv plugin that should make it possible to do what you want.

Among others, it allows:

  • 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
like image 87
Christian Brabandt Avatar answered Oct 12 '22 17:10

Christian Brabandt