Skip to main content

A simple CUI editor for Caffee.

Project description

☕ CAFFEE Command Line Text Editor

install

pip install caffee

upgrade

pip install caffee --upgrade

🇯🇵 日本語版README  Official Japanese UI Plugin  Nuitka Compilation Guide  PATH Setup Guide

CAFFEE is a lightweight terminal text editor written in Python using the curses library. It aims to provide a simple, extensible, and efficient editing experience directly in your terminal with modern IDE-like features.


✨ 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.6+
  • Unix-like terminal (Linux, macOS, ChromeOS Linux shell)
  • curses library (usually included with Python)

Quick Start

# Run the editor
caffee

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

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

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

caffee-2.4.0.tar.gz (71.1 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.4.0-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for caffee-2.4.0.tar.gz
Algorithm Hash digest
SHA256 fc52034206c7feee6be89808352bf121923a6010ba02a8628a3618af6dfabcdf
MD5 70a8b6d43046d40f181593f281d989c7
BLAKE2b-256 40f0ddfa51f4841669b8257517af38da6a0131ece8371ad357dd9eb32f50ce82

See more details on using hashes here.

Provenance

The following attestation bundles were made for caffee-2.4.0.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: caffee-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 39.2 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1019cd4bf0103f80b44b583364b888bdfbf95a69ac836fb8f1c5e25f8a81fa57
MD5 70c8dfc18ac9bab3c92f635db2aee3d6
BLAKE2b-256 24ce4127394c604870bbf092fd643527286fdbd23c01762541d63a54c01a663e

See more details on using hashes here.

Provenance

The following attestation bundles were made for caffee-2.4.0-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