r/ComputerCraft • • 6d ago

I made CChibiVim — a Vim-like code editor for computer craft (modal editing, text objects, search, syntax highlighting)

Hey everyone!

I've been working on CChibiVim, a Vim-inspired editor for my own use. But i would like to share it. It's a single-file Lua script — no dependencies, just download and run.

Install and use

wget https://raw.githubusercontent.com/rezexell/CChibiVim/refs/heads/main/cchibivim.lua

cchibivim myfile.lua (Filename is optional.)

What it does

Modal editing

  • Normal / Insert / Visual / Visual Line / Command / Search modes
  • jk in Insert mode → Normal (since Esc isn't always convenient)
  • Counts work: 5j, 3dd, 2yy, d2w, etc.

Motions

  • hjkl, w b e, W B E, 0 ^ $, gg G, { }
  • f / F + char; ; / , to repeat find

Operators & text objects

  • d, c, y combined with motions and text objects
  • Text objects: `iw aw iW aW`, plus quotes and brackets (i(, a", i[, i{, …)
  • dd yy cc, D, C, x, X, r, J, K
  • << and >> for indenting
  • p / P paste (linewise and characterwise)
  • u undo (with sensible grouping in Insert mode)

Visual mode

  • v / V / o to swap ends
  • y d c r p all work on the selection
  • Line and character selections

Search

  • / and ? with incremental matching
  • All matches highlighted, current match highlighted differently
  • n / N to jump, z to clear highlights

Command mode (:)

  • :w, :q, :q!, :x, :wq, :e {file}, :e!

Editor niceties

  • Lua syntax highlighting (keywords, strings, numbers, operators, comments, function names)
  • Autocompletion in Insert mode via textutils.complete — Ctrl+N / Ctrl+P to cycle, Enter to accept
  • Hybrid line numbers (absolute on the current line, relative elsewhere)
  • Status line showing mode + cursor position and messages
  • Dirty marker in the title, [New File] handling
  • Handles term_resize

Repo: https://github.com/rezexell/CChibiVim

Bug reports and PRs welcome!
Editor was built with help from AI during development.

67 Upvotes

3 comments sorted by

6

u/p4rad1ze 6d ago

Fuck yeah dude!!

3

u/Exnur0 4d ago

Very cool!!