显示 HN:一个带有 Vim 键绑定的终端电子表格编辑器
Show HN: A terminal spreadsheet editor with Vim keybindings

原始链接: https://github.com/garritfra/cell

## Cell:一个带有 Vim 键绑定的终端电子表格 Cell 是一个基于 Rust 的终端电子表格编辑器,提供类似 Vim 的体验。可以通过 `cargo install cell-sheet-tui` 安装,或从 GitHub Releases 页面下载预构建的二进制文件。它支持打开和保存 CSV、TSV 以及原生 `.cell` 格式(保留公式)。 导航和编辑与 Vim 密切相似 – `h/j/k/l` 用于移动,`i/a` 用于插入模式,`x` 用于清除,以及标准的 Vim 命令,如 `dd`、`yy`、`p` 和 `/` 用于搜索。公式以 `=` 开头,使用与 Excel 兼容的语法(例如,`=SUM(A1:A10)`)。 Cell 的核心功能(数据模型、公式引擎)与终端 UI 分离,从而可以独立测试。保存为 CSV 会将公式扁平化,并提示保存为 `.cell` 格式。`:w`、`:q`、`:e` 和 `:sort` 等命令提供文件管理和数据操作。 该项目采用 MIT 许可,并积极开发中,持续改进公式与 ODF 规范的兼容性。

## 带有 Vim 键绑定的新型终端电子表格 一个名为“cell-sheet”的新型基于终端的电子表格编辑器,已由其创建者 garritfra 在 Hacker News 上分享。该项目利用熟悉的 Vim 键绑定(hjkl 导航,dd/yy/p 等),提供自然的编辑体验。 它支持导入和导出 CSV/TSV 文件,并使用自定义的 `.cell` 格式存储公式。公式引擎目前处理基本的 SUM、AVERAGE 和 IF 等函数,以及范围引用。 该项目以 Cargo 工作区构建,核心逻辑与终端界面(使用 ratatui)分离,为未来的发展留下了可能性,超越了 TUI。虽然目前仍处于早期开发阶段,但可以通过 `cargo install cell-sheet-tui` 使用。 早期的反馈强调了直观的 Vim 集成和 TUI 自由核心的明智架构选择。开发者正在寻求反馈,特别是关于大型电子表格的性能考虑以及重计算、依赖跟踪和撤销/重做等功能。
相关文章

原文

A terminal spreadsheet editor with Vim keybindings, written in Rust.

cell screenshot

From crates.io:

cargo install cell-sheet-tui

Pre-built binaries for Linux, macOS, and Windows are available on the GitHub Releases page.

git clone https://github.com/garritfra/cell.git
cd cell
cargo build --release
# Binary at target/release/cell
cell                    # empty sheet
cell data.csv           # open CSV
cell data.tsv           # open TSV
cell sheet.cell         # open native format

To explore an example sheet with formulas, ranges, and IF logic:

If you know Vim, you know cell.

Key Action
h j k l Move cursor
gg First row
G Last row
0 First column
$ Last column
Ctrl-D / Ctrl-U Half-page down/up
Ctrl-F / Ctrl-B Full page down/up
w / b Next/previous non-empty cell
i / a / Enter Edit cell (Insert mode)
x Clear cell
dd Delete row
yy Yank row
p / P Paste below/above
u Undo
Ctrl-R Redo
v Visual selection
Ctrl-V Visual block selection
/ Search
n / N Next/previous match
: Command mode

Type to edit the cell. ESC or Enter confirms.

Select with hjkl, then y to yank, d to delete.

Command Action
:w Save
:w file.csv Save as CSV
:w file.cell Save as native format
:w! Force save (flatten formulas)
:q Quit
:q! Quit without saving
:wq Save and quit
:e file Open file
:sort A asc Sort by column A ascending
:sort B desc Sort by column B descending

Formulas start with = and support Excel-compatible syntax:

=A1+B1
=SUM(A1:A10)
=AVERAGE(B1:B5)
=IF(A1>100, "high", "low")

SUM, AVERAGE, COUNT, MIN, MAX, IF

Formula compliance with the ODF (OpenDocument Formula) spec is tracked and will expand over time.

  • CSV/TSV -- Opens and saves standard comma/tab-separated files. Formulas are flattened to their computed values on CSV export.
  • **.cell** -- Native format that preserves formulas. Plain text, human-readable, inspired by sc-im.

When saving a CSV that contains formulas, cell warns you and suggests saving as .cell instead. Use :w! to force a CSV save.

cell/
  crates/
    cell-sheet-core/    # Data model, formula engine, file I/O (no TUI dependency)
    cell-sheet-tui/     # Ratatui rendering, Vim modes, event loop

The core library is independent of the terminal UI and can be tested without a terminal.

  1. Update the version in [Cargo.toml](Cargo.toml) (workspace version)
  2. Update [CHANGELOG.md](CHANGELOG.md) with the new version's changes
  3. Commit: git commit -am "release: bump to vX.Y.Z"
  4. Tag and push:
 git tag vX.Y.Z
 git push origin main --tags

Pushing a v* tag triggers the release workflow, which:

  • Builds binaries for Linux (x86_64, aarch64), macOS (x86_64, aarch64), and Windows (x86_64)
  • Creates a GitHub Release with the binaries attached
  • Publishes cell-sheet-core and cell-sheet-tui to crates.io via trusted publishing

MIT

联系我们 contact @ memedata.com