Skip to main content

A simple CUI editor for Caffee.

Project description

☕ CAFFEE Terminal Text Editor

A lightweight, modern, and extensible text editor that runs in your terminal.

【Celebration】 PyPI total downloads exceeded 5K! 🎉

PyPI Version Python Version License Downloads PyPI Downloads


CAFFEE is a terminal text editor written in Python, designed for a simple, extensible, and efficient editing experience with modern IDE-like features.

Table of Contents


✨ What's New in v2.4.0

🎨 Modern UI Enhancements

  • Interactive Start Screen - Welcome screen with quick access to settings, plugins, and file explorer.
  • Tab Bar System - Multi-file editing with visual tab management.
  • Split Panel Layout - Toggle file explorer and integrated terminal panels.
  • Enhanced Visual Design - Improved color schemes and status indicators.

🚀 Productivity Features

  • Git Integration - View the current Git branch, file status in each tab (~: modified, +: new/untracked), and open a diff view (Ctrl+D).
  • Command Mode (Ctrl+P) - Execute commands like :open, :saveas, :set, and :diff.
  • Predictive Text - Get auto-completion suggestions from words in the current buffer.
  • Enhanced File Explorer (Ctrl+F) - Browse and manage files with advanced features:
    • Sort by name, date, or size (s key).
    • Toggle ascending/descending order (o key).
    • Show/hide hidden files (h key).
    • Search with wildcards (/ key).
    • Create, delete, and rename files/directories (a, d, r keys).
  • Code Templates (Ctrl+T) - Insert language-specific code snippets.
  • Built-in Terminal (Ctrl+N) - Execute commands directly from the editor.
  • Plugin & Settings Manager - Interactive menus to manage plugins and editor settings.
  • Build & Run (Ctrl+B) - Automatic compilation and execution for various languages.
  • Smart Horizontal Scrolling - Nano-style smooth scrolling for long lines.
  • Full-Width Character Support - Proper handling of Japanese and other wide characters.

🎨 Syntax Highlighting

  • Python, JavaScript, C/C++, Go, Rust, HTML, Markdown, and Git Diff support.
  • Customizable color schemes via setting.json.

📑 Multi-Tab Editing

  • Ctrl+S - Create a new tab or return to the start screen.
  • Ctrl+L - Switch to the next tab.
  • Ctrl+X - Close the current tab (prompts if unsaved).

💡 Core Features

  • Small and focused editing experience.
  • Undo/Redo history with a configurable limit.
  • Mark-based selection and clipboard operations (cut/copy/paste).
  • Line operations (delete, comment/uncomment, goto).
  • Atomic file saving with automatic backup creation.
  • Extensible plugin system and JSON configuration.

💻 Installation

Requirements

  • Python 3.8+
  • Unix-like terminal (Linux, macOS, ChromeOS Linux shell)
  • curses library (usually included with Python)

Quick Start

# Install from PyPI
pip install caffee

# Run the editor
caffee

# Or open a specific file
caffee /path/to/file.py

Upgrade

pip install caffee --upgrade

Optional: Speed Up with Nuitka

For significantly faster startup, compile with Nuitka. See the Nuitka Compilation Guide for detailed instructions.


⌨️ Keybindings

File Operations

Key Action
Ctrl+O Save current file
Ctrl+X Close current tab / Exit
Ctrl+S New tab / Start screen
Ctrl+L Switch to next tab

Editing

Key Action
Ctrl+Z Undo
Ctrl+R Redo
Ctrl+K Cut (line or selection)
Ctrl+U Paste
Ctrl+C Copy selection
Ctrl+Y Delete current line
Ctrl+/ Toggle comment

Navigation & Search

Key Action
Ctrl+W Search (with regex support)
Ctrl+G Go to line number
Ctrl+E Move to end of line
Ctrl+A Select all / Clear selection
Ctrl+6 Set/Unset mark (selection start)

Panels & Tools

Key Action
Ctrl+F Toggle file explorer
Ctrl+N Toggle integrated terminal
Ctrl+T Insert template
Ctrl+B Build/Run current file
Ctrl+D Show Git diff for the current file
Ctrl+P Enter Command Mode
Esc Return to editor from panels

🚀 Command Mode

Press Ctrl+P to enter Command Mode, then type a command and press Enter.

Command Alias Description
open <file> o <file> Open a file in a new tab.
save w Save the current file.
saveas <file> Save the current file with a new name.
close q Close the current tab.
quit qa Exit the editor (prompts for unsaved files).
new Create a new empty tab.
set <key> <val> Change a setting (e.g., set tab_width 2).
diff Show a Git diff of the current file in a new tab.

⚙️ Configuration

User settings are stored in ~/.caffee_setting/setting.json. You can edit this file directly or use the interactive settings manager from the start screen (Ctrl+S -> [2] Choice setting).

Example Configuration

{
  "tab_width": 4,
  "history_limit": 50,
  "use_soft_tabs": true,
  "backup_count": 5,
  "enable_predictive_text": true,
  
  "templates": {
    "python": "def main():\\n    print(\"Hello, world!\")\\n\\nif __name__ == \"__main__\":\\n    main()",
    "javascript": "function main() {\\n    console.log('Hello, world!');\\n}\\n\\nmain();"
  },

  "start_screen_mode": true,
  "show_explorer_default": true,
  "explorer_show_details": true,
  
  "colors": {
    "header_text": "BLACK",
    "header_bg": "WHITE",
    "keyword": "YELLOW",
    "string": "GREEN",
    "comment": "MAGENTA",
    "number": "BLUE",
    "diff_add": "GREEN",
    "diff_remove": "RED"
  }
}

Key Configuration Options

  • enable_predictive_text: Enable/disable auto-completion suggestions.
  • explorer_show_details: Show file size and modification date in the explorer.
  • displayed_keybindings: Customize which keybindings appear in the footer bar.
  • colors: Comprehensive color customization for all UI elements.

🧩 Plugin System

Extend CAFFEE's functionality with custom Python scripts placed in ~/.caffee_setting/plugins/. Use the interactive Plugin Manager (Start Screen -> Ctrl+P) to enable or disable plugins.

Plugin API

Plugins can access the editor's state and functions via an init(editor) entry point, allowing you to:

  • Bind custom key combinations.
  • Register new syntax highlighting rules.
  • Add new build commands.
  • Manipulate buffers and the cursor.
  • Display custom messages in the status bar.

🛠️ Troubleshooting

  • Display Issues: If colors or special characters don't render correctly, ensure your terminal supports 256 colors and UTF-8. For environments like iSH, CAFFEE attempts to set a compatible TERM variable automatically.
  • File Access: If you encounter errors saving files or creating backups, check the permissions for ~/.caffee_setting/.
  • Terminal Not Working: The integrated terminal requires pty support (standard on Linux and macOS).

🤝 Contributing

Contributions are welcome! Please fork the repository, make focused changes in a feature branch, and submit a pull request.


📄 License

This project is licensed under the GNU General Public License v3. 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

caffee-2.6.2.tar.gz (85.4 kB view details)

Uploaded Source

Built Distribution

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

caffee-2.6.2-py3-none-any.whl (54.5 kB view details)

Uploaded Python 3

File details

Details for the file caffee-2.6.2.tar.gz.

File metadata

  • Download URL: caffee-2.6.2.tar.gz
  • Upload date:
  • Size: 85.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for caffee-2.6.2.tar.gz
Algorithm Hash digest
SHA256 ab4eab03253929a2880d2bbc3d63b10c69c1731081fdc584e0f14e4c706da7b5
MD5 32e03bb276f7fd29ad212f7b53e11edc
BLAKE2b-256 8912464368e61c9076615eab94b376f1e9fee4478db9dc1f1c24c33b1d0fee7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for caffee-2.6.2.tar.gz:

Publisher: pypi_publish.yml on iamthe000/CAFFEE_Editor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caffee-2.6.2-py3-none-any.whl.

File metadata

  • Download URL: caffee-2.6.2-py3-none-any.whl
  • Upload date:
  • Size: 54.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for caffee-2.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ea18d6b30a10074511a111db1c68bb5375303fb57b2b5b9562ead1ff0db163b8
MD5 cab58dcb76b0d7917aae14e2b40852d3
BLAKE2b-256 34664aae1961d579cb75933e0c40d48a7362de5c6ad10c9658630702f6e48ec3

See more details on using hashes here.

Provenance

The following attestation bundles were made for caffee-2.6.2-py3-none-any.whl:

Publisher: pypi_publish.yml on iamthe000/CAFFEE_Editor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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