Skip to content
Muslu Yüksektepe

geany-csv

A CSV plugin for the Geany editor that shows the open .csv or .tsv file as an editable table.

geany-csv is a plugin I wrote for the Geany text editor. It shows the open .csv or .tsv file as an editable table in the bottom panel. When I change a cell in the table, the change is written straight into the text in the editor, and when I change the text in the editor, the table refreshes on its own.

Purpose

I use Geany often in my daily work because it is light and fast. Editing CSV files as plain text, however, gets hard as the number of columns grows. Keeping track of which value belongs to which column, quoting fields that contain the separator correctly and comparing rows all take time. Opening a separate spreadsheet program for this can also change the file's formatting.

I built this plugin so that I could edit a CSV file as a table without leaving Geany, and without touching the rest of the file while doing so.

How it works

When the plugin is enabled, a tab called "CSV Tablo" is added to Geany's message window. If the open document is a CSV or TSV file, its content is parsed and shown as a table in that tab.

The plugin detects the separator itself. Among comma, semicolon, tab and vertical bar, it picks the character that gives the most consistent number of fields per line. The separator can also be set by hand from the toolbar. Parsing follows RFC 4180, the standard that defines how separators inside quotes, quotes escaped by doubling and line breaks inside quotes are read in CSV files.

When a cell changes, the plugin does not rewrite the whole file. It replaces only the byte range of that record, using the target replacement feature of Scintilla, the text component Geany uses. This leaves the rest of the file, the cursor position and the undo history as they were, and the quoting style of untouched lines is not disturbed. If the new value contains the separator, a quote or a line break, it is quoted automatically when written to the file.

While typing continues in the editor, the table refreshes after a short delay. Selecting a row in the table moves the editor to that line.

Key features

  • The separator is detected automatically by looking at the file's content.
  • Double-clicking a cell, typing the new value and pressing Enter is all it takes to edit it.
  • Rows can be added and deleted; a new row opens with empty fields across the table's width.
  • The search box filters rows, and filtering covers the whole document.
  • Clicking a column header sorts the table, and values that look like numbers are sorted numerically.
  • Every change goes into Geany's undo history, so it can be undone with Ctrl+Z.
  • The separator choice and whether the first row is a header are saved permanently.
  • Keyboard shortcuts can be assigned to show and refresh the table.
  • Read-only documents are not edited, and a warning appears in the status bar.

Technical stack

The plugin is written in C and uses the GTK 3 interface library. It works with Geany 1.26 and later; I developed and tested it with version 1.38. The code is split into two parts. The CSV parser is independent of Geany and uses only GLib, so its unit tests can run without a graphical interface. The interface and the connection to Geany live in a separate file.

Building, testing, installing and uninstalling are handled by a Makefile. On some systems the GTK 3 development package cannot be installed because it conflicts with libraries from other repositories. For that case I added a Makefile option that unpacks the needed header files into the user's own directory without touching system packages. The number of rows shown in the table is limited to 50,000 by default; this is only a display limit, and the whole document stays editable. Because Geany's plugin interface is GPL licensed, the plugin is licensed under GPL-2.0 or later.

Use cases

  • Quickly fixing CSV files such as data exports, settings tables or small datasets in a table view.
  • Changing individual cells without breaking the file's formatting, more safely than with a separate spreadsheet program.
  • Seeing the raw text and the table view at the same time.
  • Editing tab-separated TSV files as well.

Status

The plugin does not support adding or removing columns for now, because that would require rewriting every line. The table reads Geany's UTF-8 buffer, and the file is saved in whatever encoding Geany opened it with.

Category
Developer tools
Year
2026

Technologies

  • C
  • Geany
  • CSV
  • Open Source

Links

  • GitHub https://github.com/muslu/geany-csv

Back to all projects