Skip to main content

A lightweight terminal-based text editor library for Python

Project description

PyTEdit

A lightweight, fast, terminal-based text editor library for Python. PyTEdit provides a modular and extensible framework for building terminal text editors, similar to nano or micro, but with modern Python features.

Features

  • File loading and saving
  • Arrow key navigation
  • Basic editing (insert, delete, backspace)
  • Save & quit shortcuts (Ctrl+S, Ctrl+Q)
  • Responsive interface with smooth cursor movement
  • Clean, modular code structure
  • Can be used as a library or standalone application

Installation

pip install pytedit

Quick Start

Using as a standalone editor

# Launch editor
pytedit

# Open a file
pytedit myfile.txt

Using as a library in your project

from pytedit import Editor, TextBuffer

# Create a custom editor
class MyCustomEditor(Editor):
    def __init__(self):
        super().__init__()
        # Add custom initialization
        self.status_message = "My Custom Editor"
    
    def create_key_bindings(self):
        kb = super().create_key_bindings()
        
        # Add custom key bindings
        @kb.add('c-f')
        def _(event):
            self.status_message = "Find functionality (custom)"
            self.refresh_screen()
            
        return kb

# Run your custom editor
if __name__ == "__main__":
    editor = MyCustomEditor()
    editor.run()

Architecture

PyTEdit is built around these core components:

  1. TextBuffer: Manages text content and cursor position
  2. Editor: Handles input, rendering, and coordinates components
  3. Key Bindings: Configurable keyboard shortcuts for editor functions

Development Roadmap

  • Undo/redo stack
  • Syntax highlighting with Pygments
  • Line numbers
  • Search & replace functionality
  • Configurable themes and keybindings
  • Multiple file buffers
  • Split-screen editing

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytedit-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytedit-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pytedit-0.1.0.tar.gz.

File metadata

  • Download URL: pytedit-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pytedit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9a9ebdf40fba2ad6d7bd13b4a30d4a71123434065a07500b5d242b3f31e8bd95
MD5 5276e16464d0f358f6d59ee990cb9c27
BLAKE2b-256 866829ae19a04667572ebcaff531e91a7b3467bc950d4aff49632aad2e3761a4

See more details on using hashes here.

File details

Details for the file pytedit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytedit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pytedit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf906f73afb4e877bbc0bd5e240a2fcac38bc217931407a5dcb722bbe79b4a6b
MD5 8671d39e8add777ff809d5ef105b4269
BLAKE2b-256 2a695c1472c2b82768b74530de5cade4b29f7c714413e4c70a8c5a76e1926117

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page