Skip to content

aarya-bhatia/ncurses-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

184 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ncurses Text Editor (WIP)

Status: In Progress

A terminal-based text editor built in C++ using the ncurses library, inspired by Vim. Designed to be lightweight, modular, and efficient—with tiling windows, multiple buffers, and Vim-like modal editing.


Build

git clone https://github.com/aarya-bhatia/ncurses-editor.git 
cd ncurses-editor
make

Run

bin/main [<filename1> [<filename2>...]]

Test

bin/test

Logs

Program will create and append logs to the file stderr.log in the project directory. View logs in another terminal with tail -f stderr.log.


Features (In Progress)

  • Tiling window management using a binary tree layout
  • Tab and buffer management for multiple open files
  • Vim-style modal editing: Insert, Normal, and Command modes
  • Lazy redraw: only update modified parts of the screen
  • Graceful terminal resizing
  • Plugin-like file event handlers (e.g., :Ex to explore files)
  • Chord-style keybindings for navigation and actions
  • Modular and extensible architecture

Screenshots

Screenshot 1
Screenshot 2


Insert Mode

Key Action
<Esc> Exit insert mode

Command Mode

Command Description
:q[uit] Exit program
<Esc> Exit command mode
<Enter> Execute command
:<line> Jump to specified line
:sp, :vs create horizontal/vertical split
:right, :left, :top, :bottom navigate to window pane
:tabnext / :tabprev Switch to next or previous tab
:edit <filename> / :open <filename> Open a file if it exists
:close Close current window
:tabclose Close current tab
:save Save current file to disk.
:tabnew Open and switch to new tab.
:copy Copy current line
:Ex Open file explorer in buffer

Normal Mode

Key Action
h Move left
j Move down
k Move up
l Move right
0 Jump to start of line
$ Jump to end of line
i Enter insert mode
: Enter command mode
G Go to end of file
gg Go to start of file
yy Copy the current line
p Paste copied line below
x Erase character at cursor
o Insert line below cursor
dd Delete current line
<space>w + hjkl Navigate to window split in left/down/top/right direction.
<space>wc Close window
<space>t + pn Navigate to previous/next tab
<space>te Open new tab
<space>tc Close tab

Credits


Roadmap / TODO

Core

  • Auto-scroll when cursor jumps off-screen
  • Efficient line redraw after inserts/deletes
  • Handle empty buffer states
  • Read filenames from command-line arguments
  • Open and edit multiple files
  • Use buffer IDs instead of filenames

Features

  • Line number display
  • Run external shell commands on current line
  • Visual mode
  • Popup UI for long messages
  • Command history
  • Color support

About

A vi-inspired text editor built for the terminal using ncurses

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages