Skip to main content

Femto v0.0.3

Femto is a tiny, nano-style terminal text editor written in pure Python. It ships with zero runtime dependencies on POSIX system (standard-library curses only) and automatically pulls windows-curses on Windows.

Femto supports multi-buffer editing, soft line wrapping, syntax highlighting, regex search & replace, mouse support, and is fully Unicode (CJK/Emoji) aware.

Femto v0.0.3 Terminal Editor Demo
Femto v0.0.3: Featuring the F1 help screen, stateful Python docstring highlighting, word-boundary wrapping, and multi-match search overlays.

Install

# From PyPI (Recommended)
pipx install femto-editor
# or
pip install femto-editor

# From source
git clone https://github.com/codewithzaqar/femto.git
cd femto
pip install .

After installation, the femto command is available globally.

Usage

femto [file ...]        # open one or multiple files
femto --line-numbers a.py x.py
femto --tab-size 2 --regex x.py
femto --version

Keybindings

Press F1 in normal editing mode to open read-only help. Use Up/Down, PgUp/PgDn, or Home/End to scroll; Esc or q returns to editing without changing the document. Bindings below are grouped by the context in which they work.

The tables and help share KEYBINDINGS in femto/help.py. When changing shortcuts, update that catalog and run python -m femto.help to regenerate the tables between the markers. The test suite checks that these tables stay in sync and exercises documented keys against the real input handlers. F1 is ignored in prompts and confirmations.

Help (editing only)

Key Action
F1 Open read-only help; Esc or q returns to editing

Terminal (outside help)

Key Action
Ctrl+C Interrupt and exit without save confirmation

File and buffers (editing)

Key Action
Ctrl+X Exit; asks to save modified buffers
Ctrl+S Save; Save As if unnamed
Ctrl+F / Ctrl+L Next / previous buffer

Navigation (editing)

Key Action
Arrows Move cursor
Ctrl+Left / Ctrl+Right Previous / next word
Shift+Left / Shift+Right Previous / next word
Home / Ctrl+A Line start
End / Ctrl+E Line end
PgUp / PgDn Move cursor one page up / down
Ctrl+T Go to line

Editing

Key Action
Enter Insert newline
Tab Insert indentation at cursor
Shift+Tab Remove leading indentation from current line
Backspace / Ctrl+H Delete before cursor; join at line start
Delete Delete at cursor; join at line end
Ctrl+Z / Ctrl+Y Undo / redo

Clipboard and selection (editing)

Key Action
Ctrl+B Set / clear selection mark; move cursor to select
Ctrl+K Cut selection, or current line if selection is empty
Ctrl+P Copy selection, or current line if selection is empty
Ctrl+U Paste internal clipboard

Search and replace (editing)

Key Action
Ctrl+W Open search; Enter finds next (wraps at end of buffer)
Ctrl+\ Replace: search term, replacement, then confirmation

View and mouse (editing)

Key Action
Ctrl+N Toggle line numbers
Ctrl+D Toggle mouse support
Mouse click Move cursor to clicked position (mouse enabled)
Mouse wheel Move cursor three lines up / down (mouse enabled)

Prompts (Save As, Search, Replace, Go To Line)

Key Action
Enter Confirm current prompt
Ctrl+G / Esc Cancel prompt
Left / Right Move prompt cursor
Home / End Start / end of prompt text
Backspace / Ctrl+H Delete before prompt cursor
Delete Delete at prompt cursor

Search options (Search and Replace search prompts only)

Key Action
Ctrl+O Toggle case-insensitive search
Ctrl+R Toggle regular expressions

Replace confirmation

Key Action
Y / N / A Replace current match / skip match / replace all
C / Ctrl+G / Esc Cancel remaining replacements

Exit confirmation

Key Action
Y / N Save modified buffers and exit / exit without saving
C / Ctrl+G / Esc Cancel exit

Help navigation (help only)

Key Action
Esc / q Close help and return to editing
Up / Down Scroll one help row
PgUp / PgDn Scroll one help page
Home / End First / last help page

Configuration (~/.femtorc or ./.femtorc)

Femto is highly customizable via a simple key = value configuration file.

# Indentation
tab_size = 4

# Viewport
smooth_scroll_margin = 3
soft_wrap = true
show_line_numbers = false
syntax_highlight = true

# Search
ignore_case = false
regex_search = false

# Editing
auto_indent = true
system_clipboard = false

# Wrapping
wrap_at_word = true

# Input & I/O
mouse = false
make_backup = false
# auto keeps the ending detected on load (LF for new files); lf or crlf forces it
line_ending = auto
final_newline = true  # ensure POSIX trailing newline

Running the tests

Femto includes a comprehensive unittest regression suite that runs headlessely (no terminal required).

python -m unittest discover -s tests -v

Building a release

pip install build twine
python -m build          # creates dist/femto_editor-0.0.1-*.whl
python -m twine upload dist/* # publish to PyPI

Star History

Star History Chart

License

MIT - see LICENSE.

Metadata

Release files for femto-editor 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for femto-editor 0.0.3
File Size Uploaded
femto_editor-0.0.3.tar.gz 42.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for femto-editor 0.0.3
File Interpreter ABI Platform
femto_editor-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 76.9 kB

Release files / femto_editor-0.0.3.tar.gz

Download URL femto_editor-0.0.3.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c7e70b39b902d9b9bf4730219229ae7900fd613c951770d90629584982be8fec
BLAKE2b-256 checksum
How to use checksums
f88cf1178185460060bb49690fa7e0116c50d77b79cedcd0ae404ff7e9066ed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / femto_editor-0.0.3-py3-none-any.whl

Download URL femto_editor-0.0.3-py3-none-any.whl
Size 34.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55eb69f4fbc5af6e8d93798f202d96b57df98fca58487e5d8edb7bfe6b006d84
BLAKE2b-256 checksum
How to use checksums
61517664bd896086359d412bef45d1eb74d8b3492cd0f49c747589d94c00e86c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page