A minimal, vim-inspired terminal text editor built with Python and curses.
blah is a lightweight text editor that provides vim-like functionality with a focus on simplicity and extensibility through a plugin system. It's designed for terminal environments and supports Unicode-wide characters, multiple buffers, and a growing collection of plugins.
- Vim-like keybindings: Familiar navigation and editing commands
- Unicode support: Proper handling of wide characters (CJK, etc.)
- Multiple buffers: Switch between open files
- Plugin system: Extensible architecture with various plugins
- Search & replace: Forward/backward search with case options
- Visual mode: Text selection and manipulation
- Undo/redo: Full change history with checkpoints
- External command integration: Filter text through shell commands
- Clone this repository:
git clone <repository-url>
cd blah- Make the main script executable:
chmod +x blah- (Optional) Install optional dependencies for enhanced functionality:
pip install wcwidth # For better Unicode character width handling- Create plugin directories:
mkdir -p ~/.config/blah/plugins
mkdir -p ~/.config/blah/snippets# Open a file
./blah filename.txt
# Open with a new file
./blah
# Open multiple files (use :bn, :bp to switch)
./blah file1.txt file2.txth,j,k,l- Left, down, up, rightw,W- Next word (word/space mode)b,B- Previous word (word/space mode)e,E- End of word0- Beginning of line^- First non-space character$- End of linegg- Top of fileG- Bottom of file (or to line number){,}- Previous/next empty line
i- Insert modeI- Insert at start of linea- Append after cursorA- Append at end of lineR- Replace modev- Visual modeEsc- Normal mode
x- Delete characterdd- Delete lineyy- Yank (copy) linep- Paste after cursorP- Paste before cursoru- UndoCtrl+r- Redo (via undo history)
/- Search forward?- Search backwardn- Next matchN- Previous match
:w- Save:q- Quit:wq- Save and quit:e filename- Edit file:bn,:bp- Next/previous buffer:bd- Delete buffer!command- Execute shell command and insert output
blah includes several built-in plugins that can be placed in ~/.config/blah/plugins/:
- autocomplete - Word completion using tmux menus (Ctrl+N)
- simplesnippets - Text snippets expansion (Tab key)
- syntaxhl - Syntax highlighting
- hms - Home/End key improvements
- autosave - Auto-save functionality
- clipboard - System clipboard integration
- gotodefinition - Jump to definitions
- impmov - Import movement utilities
- jedi_python_autocomplete - Python autocompletion via Jedi
- monkeytestr - Testing utilities
- rndpos - Random position jumping
- ruff_check - Python linting with Ruff
- snippets - Advanced snippet management
- tabtrap - Tab character handling
- todomojis - Todo tracking with emojis
Simply copy plugin files to ~/.config/blah/plugins/ and restart blah. Plugins are automatically loaded on startup.
Plugins are Python files that can:
- Map new keybindings using
editor.map_cmd() - Access editor state and methods
- Hook into command processing via
editor.cmd_handlers
Example plugin structure:
def my_function(editor=editor):
editor.st_extra("Hello from plugin!")
# Map Ctrl+H to show a message
editor.map_cmd(modes="NV", k=[curses.ascii.ctrl('h')], cb=my_function)ESCDELAY- ESC key delay in milliseconds (default: 25)HOME- User home directory (for config files)
~/.config/blah/plugins/- Plugin files~/.config/blah/snippets/- Text snippets
Create text files in ~/.config/blah/snippets/ with the snippet name as the filename. The file content becomes the snippet expansion.
- Python 3.6+
- Standard library modules:
cursesossysunicodedata
Optional dependencies:
wcwidth- Enhanced Unicode width calculationjedi- Python autocompletionruff- Python lintingtmux- Required for some plugin features (autocomplete menus)
- Lazy loading of plugins and modules for fast startup
- Efficient text rendering with Unicode support
- Minimal memory footprint with undo history management
- No GUI interface (terminal only)
- Limited syntax highlighting (plugin-dependent)
- Some advanced vim features may not be implemented
- Plugin system requires manual setup
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by vim's modal editing philosophy
- Built with Python's curses library
- Plugin architecture influenced by various text editors
- Unicode handling techniques from the wcwidth project