Skip to content

ramparte/vi-v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vi Editor Clone

A complete, production-quality vi editor clone implementation in Python.

Features

  • Full vi modal interface (normal, insert, visual, command modes)
  • All standard vi motions (h, j, k, l, w, b, e, 0, $, ^, G, gg, +, -, etc.)
  • Complete operator set (d, c, y, p, P, x, X, ~, J, etc.)
  • Visual mode (v, V) with operators
  • Text buffer management with undo/redo
  • File operations (open, save, quit)
  • Ex commands (:w, :q, :wq, :q!, etc.)
  • Terminal-based rendering
  • 100% passing torture test suite (120/120 tests)

Installation

Using uv (recommended)

# Install dependencies
uv sync

# The editor will be available in your virtual environment

Using pip

pip install -e .

Usage

Running the editor

# Using the installed command
vi filename.txt

# Or using Python module directly
python -m vi_editor.main filename.txt

# With uv
uv run python -m vi_editor.main filename.txt

Basic Vi Commands

  • i - Enter insert mode before cursor
  • a - Enter insert mode after cursor
  • ESC - Return to normal mode
  • :w - Save file
  • :q - Quit
  • :wq - Save and quit
  • :q! - Quit without saving
  • h/j/k/l - Move cursor left/down/up/right
  • dd - Delete line
  • yy - Yank (copy) line
  • p - Put (paste) after cursor
  • u - Undo
  • v - Visual mode

Architecture

The editor is structured in modular components:

  • Core Engine: Buffer management, cursor handling
  • Command System: Modal interface, command parsing
  • User Interface: Terminal rendering, input processing
  • File Operations: File I/O, backup, recovery

Testing

pytest tests/

Development

This is a complete implementation following vi specifications, with no stubs or placeholders.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages