Cub is a lightweight, BLAZINGLY-FAST, terminal-based text editor built for speed and simplicity. Inspired by Kakoune and Vim, Cub offers intuitive keyboard navigation that strikes a balance between functionality and ease of use. Cub is meant to be an alternative to simple text editors like Nano etc.
Cub operates with two streamlined modes:
- View Mode: Navigate, select, and manipulate text with precision.
- Insert Mode: Seamlessly edit and insert text where needed.
With advanced navigation tools such as line jumps, word motions, and bracket matching, Cub offers a superior text editing experience compared to traditional editors like Nano. It’s designed to fit into your workflow, offering faster navigation, fewer keystrokes, and better text management.
Cub is perfect for developers, system administrators, and power users who need a fast, no-frills editor that maximizes efficiency without sacrificing simplicity.
The navigation system in Cub follows a Kakoune-like style with some elements inspired by Vim motions. This provides powerful yet simple navigation, aiming to be more intuitive than Nano without introducing unnecessary complexity. Navigation is separated into simple and complex actions to align with the two modes (View and Insert).
- Arrow Keys (
↑
,↓
,←
,→
) oro
,p
,k
,l
: Move the cursor in all directions. Home
/End
: Move to the start or end of the current line.PgUp
/PgDn
: Scroll up or down by a quarter of the screen.
These advanced motions allow for more efficient movement throughout the document:
- Numbers (
0-9
): Build a line number to jump to. G
: Jump to the line specified by the accumulated number, or the end of the document if no number is provided.w
: Move to the next word boundary.b
: Move to the previous word boundary.(
/)
: Move to the matching bracket.e
: Jump to the next empty line.E
: Jump to the previous empty line.^
: Move to the first non-whitespace character of the current line.$
: Move to the end of the current line.z
: Center the cursor on the screen.g
: Jump to the top of the document (line 0, column 0).
While in Insert Mode, basic cursor navigation is still available:
- Arrow Keys: Move the cursor in any direction.
Home
/End
: Jump to the beginning or end of the line.PgUp
/PgDn
: Scroll the view up or down by a quarter of the screen.
- G + [number]: Jump to the specified line. If no number is provided, it jumps to the end of the document.
(Example: Pressing4G
moves the cursor to line 4.)
Cub offers automatic navigation between matching brackets:
(
/)
: Jump between matching parentheses.- Supports both round brackets (
()
), and curly brackets ({}
).
- Page Up / Down: Move the view by a quarter of the visible screen.
w
/b
: Jump forward to the next word boundary or backward to the previous one.
These shortcuts help jump between empty lines, improving navigation within long documents:
e
: Move to the next empty line.E
: Move to the previous empty line.
- Open Cub and navigate using arrow keys or
o
,p
,k
,l
. - Switch to Insert Mode with
i
and type your text. - Save the document with
Ctrl+S
. - Exit the editor with
Ctrl+Q
.
To install and build Cub, follow these steps:
git clone https://github.com/yourusername/cub.git
cd cub
make build
After installation, start the editor by running:
./cub <filename>
- If you accidentally delete a line, undo it using
Ctrl+U
. - Use
Home
orEnd
to jump to the beginning or end of a line. - Use selection (
s
to start,z
to end) for bulk operations like cut or copy.