A simple CUI editor for Caffee.
Project description
☕ CAFFEE Command Line Text Editor
🇯🇵 日本語版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.0.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
- Integrated File Explorer (
Ctrl+F) - Browse and open files without leaving the editor - Built-in Terminal (
Ctrl+T) - Execute commands and run code directly from the editor - Plugin Manager (
Ctrl+Pfrom start screen) - Enable/disable plugins with visual interface - Build & Run (
Ctrl+B) - Automatic compilation and execution for Python, JavaScript, Go, C/C++, Rust, and shell scripts - 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 support
- Customizable color schemes via settings
📑 Multi-Tab Editing
Ctrl+S- Create new tab or return to start screenCtrl+L- Switch to next tabCtrl+X- Close current tab (prompts if unsaved)
💡 Core Features
- Small and focused editing experience
- Undo/Redo history with configurable limit
- Mark-based selection and clipboard operations (cut/copy/paste)
- Line operations (delete, comment/uncomment, goto)
- Atomic file saving with automatic backup creation
- Plugin system for extensibility
- JSON configuration for customization
💻 Installation
Requirements
- Python 3.6+
- Unix-like terminal (Linux, macOS, ChromeOS Linux shell)
curseslibrary (usually included with Python)
Quick Start
# Download or clone the repository
git clone <repository-url>
cd CAFFEE_Editor
# Run directly
python3 caffee.py
# Or open a specific file
python3 caffee.py /path/to/file.py
Optional: Speed Up with Nuitka
For significantly faster startup and execution, compile with Nuitka (Debian/Ubuntu):
python3 -m venv myenv
source myenv/bin/activate
pip install nuitka
sudo apt install patchelf
python -m nuitka --standalone caffee.py
cd caffee.dist
./caffee.bin
See Nuitka_Step.md for detailed instructions and troubleshooting.
⌨️ 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) |
| Arrow Keys | Navigate cursor |
| PageUp/Down | Scroll by page |
Panels & Tools
| Key | Action |
|---|---|
Ctrl+F |
Toggle file explorer |
Ctrl+T |
Toggle integrated terminal |
Ctrl+B |
Build/Run current file |
Ctrl+P |
Plugin manager (from start screen) |
Esc |
Return to editor from panels |
⚙️ Configuration
User settings are stored in ~/.caffee_setting/setting.json.
Example Configuration
{
"tab_width": 4,
"history_limit": 50,
"use_soft_tabs": true,
"backup_subdir": "backup",
"backup_count": 5,
"show_splash": true,
"splash_duration": 500,
"start_screen_mode": true,
"explorer_width": 35,
"terminal_height": 10,
"show_explorer_default": false,
"show_terminal_default": false,
"colors": {
"header_text": "BLACK",
"header_bg": "WHITE",
"error_text": "WHITE",
"error_bg": "RED",
"linenum_text": "CYAN",
"linenum_bg": "DEFAULT",
"selection_text": "BLACK",
"selection_bg": "CYAN",
"keyword": "YELLOW",
"string": "GREEN",
"comment": "MAGENTA",
"number": "BLUE",
"ui_border": "WHITE",
"tab_active_bg": "BLUE"
}
}
Configuration Options
- Editor Settings:
tab_width,history_limit,use_soft_tabs - Backup:
backup_subdir,backup_count(automatic versioned backups) - Startup:
show_splash,splash_duration,start_screen_mode - Layout:
explorer_width,terminal_height, panel visibility defaults - Colors: Comprehensive color customization for all UI elements
🧩 Plugin System
Plugins are Python files in ~/.caffee_setting/plugins/.
Plugin API
Plugins can expose an init(editor) function with access to:
- Cursor & Buffer Access:
get_cursor_position(),get_line_content(),get_buffer_lines() - Editing Operations:
insert_text_at_cursor(),delete_range(),replace_text() - Selection:
get_selection_text(),get_selection_range() - Key Binding:
bind_key(key_code, function) - UI Feedback:
set_status_message(),redraw_screen() - User Input:
prompt_user(message, default="")
Example Plugin
def init(editor):
def uppercase_selection(ed):
text = ed.get_selection_text()
if text:
lines = [line.upper() for line in text]
# Process selection...
ed.set_status_message("Converted to uppercase!")
else:
ed.set_status_message("No selection")
# Bind to Ctrl+Shift+U (if terminal supports)
editor.bind_key(21, uppercase_selection)
Plugin Manager
Access via Ctrl+P from the start screen:
- View all installed plugins
- Enable/disable plugins with spacebar
- Changes take effect after editor restart
Disabled plugins are moved to ~/.caffee_setting/plugins/disabled/.
🚀 Built-in Commands
CAFFEE automatically detects file types and provides build/run commands:
| File Type | Command |
|---|---|
.py |
python3 <file> |
.js |
node <file> |
.go |
go run <file> |
.c |
gcc <file> -o <output> && ./<output> |
.cpp, .cc |
g++ <file> -o <output> && ./<output> |
.sh |
bash <file> |
.rs |
rustc <file> && ./<output> |
Press Ctrl+B to save and run the current file. Output appears in the integrated terminal.
🛠️ Troubleshooting
Display Issues
- Japanese text garbled? See Nuitka_Step.md for locale configuration
- Colors not working? Ensure your terminal supports 256 colors
- Curses errors? Verify Python's curses library is available on your platform
File Operations
- File changed on disk: CAFFEE detects external changes but won't auto-reload to prevent data loss
- Backup files: Located in
~/.caffee_setting/backup/with timestamps
Terminal Integration
- Terminal not working? The integrated terminal requires
ptysupport (Unix-like systems only) - Build command fails? Ensure required compilers/interpreters are in your PATH
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make focused, well-documented changes
- Test in multiple terminal environments
- Submit a pull request with clear descriptions
Development Guidelines
- Maintain compatibility with Python 3.6+
- Respect terminal resizing behavior
- Keep the codebase simple and readable
- Follow existing code style
📄 License
MIT License - See LICENSE file for details.
🙏 Acknowledgments
Built with Python's curses library. Inspired by nano, vim, and modern code editors.
CAFFEE - Brew your code in the terminal ☕
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file caffee-2.0.5.tar.gz.
File metadata
- Download URL: caffee-2.0.5.tar.gz
- Upload date:
- Size: 57.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a7bdb6d43034293b7d89ff15012b1e6a01cbdcde7085204283411fec8ed9b57
|
|
| MD5 |
3914621e3726a8dc45b825e486985809
|
|
| BLAKE2b-256 |
996c4d56a6f341a1f934f84ccb8bad57c2384eea875018761943de7f491c5629
|
Provenance
The following attestation bundles were made for caffee-2.0.5.tar.gz:
Publisher:
pypi_publish.yml on iamthe000/CAFFEE_Editor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
caffee-2.0.5.tar.gz -
Subject digest:
7a7bdb6d43034293b7d89ff15012b1e6a01cbdcde7085204283411fec8ed9b57 - Sigstore transparency entry: 732076999
- Sigstore integration time:
-
Permalink:
iamthe000/CAFFEE_Editor@eb64dabbc308dd6ab129a715f5c5d3493ea8937e -
Branch / Tag:
refs/tags/2.0.5 - Owner: https://github.com/iamthe000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@eb64dabbc308dd6ab129a715f5c5d3493ea8937e -
Trigger Event:
push
-
Statement type:
File details
Details for the file caffee-2.0.5-py3-none-any.whl.
File metadata
- Download URL: caffee-2.0.5-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57d1e8c25dbabe1fdecd75ff87bfeccb0678080fda3602e3ce6032f7bee86578
|
|
| MD5 |
2929635ec38a080eb4a381921c6655c1
|
|
| BLAKE2b-256 |
cd5f2c43f143fe16323393d94c41a37539c47c4446b50f1418767776440d99d1
|
Provenance
The following attestation bundles were made for caffee-2.0.5-py3-none-any.whl:
Publisher:
pypi_publish.yml on iamthe000/CAFFEE_Editor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
caffee-2.0.5-py3-none-any.whl -
Subject digest:
57d1e8c25dbabe1fdecd75ff87bfeccb0678080fda3602e3ce6032f7bee86578 - Sigstore transparency entry: 732077002
- Sigstore integration time:
-
Permalink:
iamthe000/CAFFEE_Editor@eb64dabbc308dd6ab129a715f5c5d3493ea8937e -
Branch / Tag:
refs/tags/2.0.5 - Owner: https://github.com/iamthe000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@eb64dabbc308dd6ab129a715f5c5d3493ea8937e -
Trigger Event:
push
-
Statement type: