Skip to content

RealOrko/smash-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

83 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ SmashEdit

A lightning-fast, terminal-based text editor built with C and ncurses

Version License Platform


โœจ Features

  • ๐Ÿš€ Lightning Fast โ€” Written in C for maximum performance
  • ๐Ÿ“ Modal Editing โ€” Intuitive keyboard-driven interface
  • ๐ŸŽจ Beautiful TUI โ€” Colorful terminal interface with Unicode box-drawing
  • โ†ฉ๏ธ Undo/Redo โ€” Full history with up to 100 levels
  • ๐Ÿ” Search & Replace โ€” Find text with case-sensitive toggle
  • ๐Ÿ“‹ Clipboard Support โ€” Cut, copy, and paste with ease
  • ๐Ÿ”ข Line Numbers โ€” Toggle-able line number display
  • ๐Ÿ“‘ Multi-Select โ€” Select multiple occurrences with Ctrl+D
  • ๐ŸŒ Unicode Support โ€” Full UTF-8 and wide character support

๐Ÿ“ธ Screenshot

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  File   Edit   Search   View   Help                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  1 โ”‚ #include <stdio.h>                                     โ”‚
โ”‚  2 โ”‚                                                        โ”‚
โ”‚  3 โ”‚ int main() {                                           โ”‚
โ”‚  4 โ”‚     printf("Hello, SmashEdit!\n");                     โ”‚
โ”‚  5 โ”‚     return 0;                                          โ”‚
โ”‚  6 โ”‚ }                                                      โ”‚
โ”‚                                                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Line: 4  Col: 12  | hello.c [Modified]                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Installation

Quick Install (Recommended)

curl -fsSL https://raw.githubusercontent.com/RealOrko/smash-editor/main/scripts/install.sh | bash

This will:

  • Download the latest release for your platform
  • Install to ~/.smash
  • Add to your PATH automatically

Build from Source

Prerequisites

  • ๐Ÿ”ง CMake 3.10+
  • ๐Ÿ–ฅ๏ธ GCC or compatible C compiler
  • ๐Ÿ“š ncurses library with wide character support

Install dependencies

๐Ÿง Ubuntu/Debian
sudo apt-get update
sudo apt-get install build-essential cmake libncursesw5-dev
๐Ÿง Fedora/RHEL
sudo dnf install gcc cmake ncurses-devel
๐Ÿง Arch Linux
sudo pacman -S base-devel cmake ncurses
๐ŸŽ macOS
brew install cmake ncurses

Build & Install

# Clone the repository
git clone https://github.com/RealOrko/smash-editor.git
cd smash-editor

# Build
make build

# Install to ~/.smash/
make install

Run

# After installation (restart terminal first)
smashedit

# Or run directly
~/.smash/smashedit

# Open a file
smashedit myfile.txt

โŒจ๏ธ Keyboard Shortcuts

๐Ÿ“ File Operations

Shortcut Action
Ctrl+N ๐Ÿ“„ New file
Ctrl+O ๐Ÿ“‚ Open file
Ctrl+S ๐Ÿ’พ Save file
Ctrl+Shift+S ๐Ÿ’พ Save as
Ctrl+Q ๐Ÿšช Quit

โœ๏ธ Editing

Shortcut Action
Ctrl+Z โ†ฉ๏ธ Undo
Ctrl+Y โ†ช๏ธ Redo
Ctrl+X โœ‚๏ธ Cut (or cut line if no selection)
Ctrl+C ๐Ÿ“‹ Copy
Ctrl+V ๐Ÿ“Œ Paste
Ctrl+A ๐Ÿ”ฒ Select all
Ctrl+D โž• Add next occurrence to selection

๐Ÿ” Search

Shortcut Action
Ctrl+F ๐Ÿ”Ž Find
F3 โญ๏ธ Find next
Ctrl+H ๐Ÿ”„ Replace
Ctrl+G ๐Ÿ”ข Go to line

๐Ÿงญ Navigation

Shortcut Action
โ†‘ โ†“ โ† โ†’ Move cursor
Ctrl+โ† / โ†’ Move by word
Home / End Line start/end
Ctrl+Home / End Document start/end
Ctrl+T ๐Ÿ” Go to start (alternative)
Ctrl+B ๐Ÿ”š Go to end (alternative)
PgUp / PgDn Scroll page

๐ŸŽฏ Selection

Shortcut Action
Shift+Arrows Select characters
Shift+Home/End Select to line start/end
Ctrl+Shift+โ† / โ†’ Select word
Esc Clear selection

๐Ÿ“‹ Menu

Shortcut Action
F10 Open menu bar
Esc Close menu

๐Ÿ—๏ธ Project Structure

smashedit/
โ”œโ”€โ”€ ๐Ÿ“„ CMakeLists.txt      # CMake build configuration
โ”œโ”€โ”€ ๐Ÿ“„ Makefile            # Build wrapper
โ”œโ”€โ”€ ๐Ÿ“ include/
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ smashedit.h     # Main header file
โ”œโ”€โ”€ ๐Ÿ“ src/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ main.c          # Entry point & signal handling
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ editor.c        # Core editor logic
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ buffer.c        # Gap buffer implementation
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ display.c       # UI rendering
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ input.c         # Keyboard input handling
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ dialog.c        # Dialog boxes
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ search.c        # Find/replace functionality
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ smenu.c         # Menu system
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ undo.c          # Undo/redo stack
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ file.c          # File I/O operations
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ clipboard.c     # Clipboard management
โ””โ”€โ”€ ๐Ÿ“ bin/                # Build output (generated)

โš™๏ธ Configuration

SmashEdit can be configured at compile-time by modifying include/smashedit.h:

#define TAB_WIDTH 2           // Tab width in spaces
#define MAX_UNDO_LEVELS 100   // Maximum undo history
#define MAX_SELECTIONS 1024   // Maximum multi-select ranges
#define MAX_LINE_LENGTH 4096  // Maximum line length

๐ŸŽจ Color Scheme

Element Colors
Editor Area โฌœ White on ๐ŸŸฆ Blue
Menu Bar โฌ› Black on ๐Ÿฉต Cyan
Selected Text ๐ŸŸจ Yellow on ๐ŸŸฆ Blue
Dialog Boxes โฌœ White on ๐ŸŸฆ Blue
Status Bar โฌ› Black on ๐Ÿฉต Cyan

๐Ÿ”ง Building from Source

Using Make (Recommended)

# Build the project
make build

# Clean build artifacts
make clean

# Install to ~/.smashedit/
make install

Using CMake Directly

# Configure
cmake -B bin -S . -DCMAKE_BUILD_TYPE=Release

# Build
cmake --build bin

# The binary will be at bin/smashedit

๐Ÿ“Š Technical Details

Metric Value
๐Ÿ’ป Language C (C11 standard)
๐Ÿ“ Lines of Code ~4,000
๐Ÿ“ฆ Dependencies ncurses only
๐Ÿงฉ Modules 11 components
๐Ÿ“ Buffer Type Gap Buffer

๐Ÿ›๏ธ Architecture

  • Gap Buffer โ€” Efficient text storage for real-time editing
  • Modular Design โ€” Clean separation of concerns
  • Signal Handling โ€” Graceful shutdown and terminal resize
  • Memory Safe โ€” Proper allocation and cleanup

๐Ÿ—บ๏ธ Roadmap

  • ๐ŸŽจ Syntax highlighting
  • ๐Ÿ“‘ Multiple buffers/tabs
  • ๐Ÿ”Œ Plugin system
  • โš™๏ธ Configuration file support
  • ๐Ÿ–ฑ๏ธ Mouse support
  • ๐Ÿ“œ Macro recording

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create your feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add amazing feature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/amazing-feature)
  5. ๐Ÿ”€ Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • ๐Ÿ“š ncurses โ€” The terminal UI library that makes this possible
  • ๐Ÿ’ก Inspired by classic terminal editors like nano, vim, and micro

Made with โค๏ธ and โ˜•

โญ Star this repo if you find it useful!

About

An editor I wanted ...

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages