Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🖊️ Nano — Go Terminal Editor for Windows

A lightweight, fast, terminal-based text editor written in Go — inspired by GNU Nano — built specifically for Windows, with native MSI installer support and full PATH integration.


Go Version Platform License Installer Status


📖 Table of Contents


🧭 Overview

Nano is a terminal-based text editor written entirely in Go, designed to bring the familiar, keyboard-driven experience of GNU Nano to the Windows ecosystem. It runs entirely in the terminal — no GUI, no dependencies, no bloat.

Whether you're editing config files, writing scripts, or just need a quick way to open and modify text files from the command line, Nano gives you a Unix-like editing experience right inside cmd.exe or PowerShell.

It ships with a WiX v7 MSI installer that registers the nano command system-wide and adds it to your PATH automatically — making it immediately available from any terminal, anywhere on your system.


✨ Features

🖥️ Terminal-Based Editing (No GUI)

Nano runs entirely inside the Windows terminal. There are no windows, no graphical elements, and no mouse dependency. Everything is keyboard-driven, keeping you in flow without context-switching.

📂 File Opening from the Command Line

Open any file directly from cmd.exe or PowerShell using a simple, familiar command:

nano file.txt
nano C:\Users\you\Documents\notes.txt

If the file does not exist, Nano will offer to create it automatically.

✏️ File Editing, Saving, and Creation

  • Edit any plain-text file in-place
  • Save changes at any time with Ctrl+O
  • Exit with Ctrl+X (with unsaved-changes prompt)
  • Create new files on the fly by providing a non-existent path

🧭 Cursor Movement and Keyboard Controls

Full cursor navigation using arrow keys, Home, End, Page Up, and Page Down. Move character-by-character, line-by-line, or jump to the beginning/end of a line instantly.

🎨 Theme and Config System (.nanorc Support)

Nano supports a .nanorc configuration file located in your home directory (%USERPROFILE%\.nanorc). You can configure:

  • Color themes
  • Tab width
  • Line number display
  • Soft-wrap behavior
  • Editor preferences

🔗 Windows System Integration via PATH

The MSI installer registers nano as a system-wide command by adding its installation directory to the Windows PATH environment variable — no manual configuration required.

📦 MSI Installer Support (WiX v7)

Nano ships with a professional WiX v7-based .msi installer that:

  • Installs the nano.exe binary to Program Files
  • Automatically adds the install directory to the system PATH
  • Supports clean uninstallation via Windows "Add or Remove Programs"
  • Follows Windows installer best practices with GUID-based upgrades

🎯 Project Goals

Nano was built with a focused set of principles:

Goal Description
Linux-like CLI experience on Windows Bring the speed and simplicity of GNU Nano to Windows terminals without requiring WSL or Cygwin
Lightweight and fast Zero external runtime dependencies. A single statically-linked binary under 10MB
Keyboard-driven workflow All core operations available through intuitive keyboard shortcuts, just like GNU Nano
Professional Windows integration First-class installer via WiX v7 MSI — installs cleanly, uninstalls cleanly
Extensible by design Modular internal architecture makes it easy to add features without rewiring the core
Developer-friendly Written in idiomatic Go; easy to build, easy to fork, easy to contribute to

📁 Project Structure

nano/
├── main.go                     # Entry point — parses CLI args, bootstraps the editor
│
├── internal/
│   ├── buffer/
│   │   └── buffer.go           # Text buffer management — stores and mutates file content
│   │
│   ├── config/
│   │   └── config.go           # .nanorc parser — reads user preferences and theme settings
│   │
│   ├── editor/
│   │   └── editor.go           # Core editor loop — coordinates input, render, and buffer
│   │
│   ├── input/
│   │   └── input.go            # Keyboard input handler — maps raw key events to editor actions
│   │
│   └── render/
│       └── render.go           # Terminal renderer — draws the editor UI to the screen
│
├── wix7/
│   └── nano.wxs                # WiX v7 installer source — defines the MSI build configuration
│
├── bin/                        # Output directory for compiled artifacts
│   ├── nano.exe                # Compiled Windows binary (generated)
│   └── nano.msi                # Compiled MSI installer (generated)
│
├── go.mod                      # Go module definition
├── go.sum                      # Dependency lock file
├── .nanorc.example             # Example configuration file for users
└── README.md                   # This file

Module Responsibilities

main.go

The entry point of the application. Handles command-line argument parsing (file path), loads the configuration, initializes the terminal, and hands control to the editor loop.

internal/buffer/buffer.go

Manages the in-memory representation of the file being edited. Handles line splitting, character insertion/deletion, undo history, and serialization back to disk.

internal/config/config.go

Reads and parses the .nanorc file from the user's home directory. Exposes a typed Config struct that the rest of the application uses for behavioral and visual settings.

internal/editor/editor.go

The central coordinator. Contains the main event loop that reads keyboard input, dispatches actions, updates the buffer, and triggers re-renders. This is the heart of the application.

internal/input/input.go

Low-level keyboard input handling for Windows terminals. Translates raw terminal escape sequences and Windows console key events into high-level Action types consumed by the editor.

internal/render/render.go

Responsible for drawing the editor to the terminal. Manages the status bar, line numbers, cursor position display, and color/theme rendering. Optimizes redraws to minimize flicker.


⌨️ Keyboard Shortcuts

File Operations

Shortcut Action
Ctrl+O Save file — Write the current buffer to disk
Ctrl+X Exit — Quit the editor (prompts if unsaved changes exist)
Ctrl+R Read file — Insert contents of another file at cursor position

Navigation

Shortcut Action
Arrow Keys Move cursor up, down, left, right
Home Move cursor to the beginning of the current line
End Move cursor to the end of the current line
Ctrl+Home Jump to the very beginning of the file
Ctrl+End Jump to the very end of the file
Page Up Scroll up one page
Page Down Scroll down one page
Ctrl+← Jump one word to the left
Ctrl+→ Jump one word to the right

Search

Shortcut Action
Ctrl+W Search — Open the search bar and find text in the buffer
Ctrl+G Next match — Jump to the next occurrence of the search term

Editing

Shortcut Action
Backspace Delete character to the left of the cursor
Delete Delete character to the right of the cursor
Enter Insert a new line at the cursor position
Tab Insert a tab (or spaces, depending on config)
Ctrl+K Cut line — Cut the current line to the clipboard buffer
Ctrl+U Paste — Paste the last cut line at the cursor position

Miscellaneous

Shortcut Action
Ctrl+C Display current cursor position (line and column)
Ctrl+L Refresh / redraw the screen
Ctrl+Z Undo last action (planned)

🚀 Installation

Prerequisites

Before building or installing Nano, ensure the following are available on your system.

Go (1.21 or later ONLY IF YOU ARE BUILDING)

Download and install Go from the official website:

https://golang.org/dl/

Verify the installation:

go version
# Expected output: go version go1.21.x windows/amd64

WiX v7 (for MSI installer ONLY IF YOU ARE BUILDING)

Download and install WiX Toolset v7 from:

https://wixtoolset.org/

Or install via the .NET tool:

dotnet tool install --global wix

Verify WiX is available:

wix --version
# Expected output: 4.x.x or 7.x.x

Build from Source

1. Clone the Repository

git clone https://github.com/yourusername/nano.git
cd nano

2. Install Dependencies

go mod tidy

This will download and resolve all Go module dependencies defined in go.mod.

3. Build the Binary

go build -o bin\nano.exe .

This produces a standalone nano.exe binary in the bin\ directory. The binary has no external runtime dependencies and can be run directly.

4. (Optional) Add to PATH Manually

If you are not using the MSI installer, you can manually add the bin\ directory to your system PATH:

# PowerShell — add to user PATH permanently
$env:PATH += ";$PWD\bin"
[System.Environment]::SetEnvironmentVariable("PATH", $env:PATH, "User")

Or use the Windows GUI: System Properties → Environment Variables → PATH → Edit → New.


MSI Installer (WiX v7)

The MSI installer provides a clean, professional installation experience that integrates Nano into Windows properly — no manual PATH editing required.

1. Build the Binary First

go build -o bin\nano.exe .

2. Build the MSI

wix build -acceptEula wix7\nano.wxs -o bin\nano.msi

This will produce bin\nano.msi — a fully self-contained Windows installer package.

3. Install

Double-click bin\nano.msi or run silently from an elevated PowerShell prompt:

msiexec /i bin\nano.msi /quiet

4. Verify Installation

Open a new terminal session (so the updated PATH is loaded) and run:

nano --version

You should see the Nano version banner. The nano command is now available from any directory, in both cmd.exe and PowerShell.

5. Uninstall

Uninstall via Settings → Apps → Nano or silently:

msiexec /x bin\nano.msi /quiet

💡 Usage

Open an Existing File

nano notes.txt
nano C:\Users\you\Documents\config.yaml
nano .\scripts\deploy.ps1

Create a New File

If the file does not exist, Nano will create it when you save:

nano newfile.txt

Type your content, then press Ctrl+O to save and Ctrl+X to exit.

Open a File in Read-Only Mode (planned)

nano --view readonly.log

Quick Edit and Exit

nano hosts.txt
# Make your edits
# Ctrl+O → Enter  (save)
# Ctrl+X          (exit)

Pipe Input (planned)

echo "Hello, World" | nano

⚙️ Configuration — .nanorc

Nano reads its configuration from %USERPROFILE%\.nanorc on startup.

Create or edit the file:

nano %USERPROFILE%\.nanorc

Example .nanorc

# Nano configuration file

# Display line numbers in the left margin
set linenumbers

# Use 4 spaces for tab indentation
set tabsize 4

# Convert tabs to spaces automatically
set tabstospaces

# Wrap long lines at window edge
set softwrap

# Enable smooth scrolling
set smooth

# Show cursor position in the status bar
set constantshow

# Color theme: dark | light | classic
set theme dark

Supported Configuration Keys

Key Type Default Description
linenumbers flag off Show line numbers in the left margin
tabsize integer 4 Number of spaces per tab stop
tabstospaces flag off Convert tab characters to spaces on insert
softwrap flag off Wrap long lines visually (no hard wrap)
smooth flag off Smooth line-by-line scrolling
constantshow flag off Always show cursor line/column in status bar
theme string dark Color theme: dark, light, or classic

🖥️ Supported Platforms

Platform Status Notes
Windows 10 / 11 ✅ Fully Supported Primary target platform. MSI installer available.
Windows Server 2019+ ✅ Supported Works in Server Core terminal sessions.
Linux 🔄 Possible (future) Core editor logic is platform-agnostic. Terminal backend may need adaptation.
macOS 🔄 Possible (future) Same as Linux — Go binary compiles cross-platform.
WSL (Windows Subsystem for Linux) ⚠️ Untested May work; not an official target. Use GNU Nano inside WSL instead.

Primary focus: Windows. The MSI installer, PATH integration, and terminal input handling are specifically designed and tested for Windows terminals (cmd.exe, PowerShell, Windows Terminal).


🔮 Future Improvements

The following features are planned or under consideration for future releases:

🎨 Syntax Highlighting

Language-aware colorization for common file types:

  • Go, Python, JavaScript, TypeScript, Rust
  • JSON, YAML, TOML, XML
  • Bash/PowerShell scripts
  • Markdown, HTML, CSS

Syntax definitions will be configurable via .nanorc or dedicated syntax files in ~/.nano/syntax/.

🔍 Full Search and Replace

  • Ctrl+W — incremental forward search
  • Ctrl+\ — search and replace with confirmation prompt
  • Regex support for power users
  • Case-sensitive and case-insensitive modes

📑 Multi-Tab Editing

Open multiple files simultaneously in tabbed buffers. Switch between tabs with Ctrl+Tab / Ctrl+Shift+Tab. Each buffer maintains its own undo history.

↩️ Undo / Redo

Full multi-level undo (Ctrl+Z) and redo (Ctrl+Y) history with configurable depth.

🔌 Plugin System

A lightweight Lua or Go-based plugin API that allows users to extend Nano with custom key bindings, commands, and syntax definitions without modifying the core source.

🖱️ Mouse Support

Optional mouse support for cursor placement and scrolling inside Windows Terminal.

📋 System Clipboard Integration

Full integration with the Windows clipboard so that Ctrl+C / Ctrl+V work naturally with other applications.

🌐 Unicode and UTF-8

Robust Unicode handling including full UTF-8 file reading/writing, multi-byte character cursor movement, and display of CJK and emoji characters.

🔢 Goto Line

Ctrl+_ — jump directly to a specific line number.

📜 Session Restore

Optionally remember the last opened file and cursor position between sessions.

🛠️ Automated Release Pipeline

GitHub Actions workflow to:

  • Cross-compile for Windows (amd64, arm64)
  • Build and sign the MSI installer
  • Publish GitHub releases with attached assets

🤝 Contributing

Contributions are welcome! If you'd like to fix a bug, add a feature, or improve the documentation:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m "feat: add my feature"
  4. Push to your fork: git push origin feature/my-feature
  5. Open a Pull Request against main

Please follow Conventional Commits for commit messages and keep PRs focused on a single concern.

Development Tips

# Run directly without building
go run . myfile.txt

# Run tests
go test ./...

# Run tests with verbose output
go test -v ./...

# Check for race conditions
go test -race ./...

# Build with debug symbols
go build -gcflags="all=-N -l" -o bin\nano-debug.exe .

📄 License

MIT License

Copyright (c) 2026 [Nay]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

👤 Author

[Nay]


🙏 Acknowledgements

  • Inspired by GNU Nano — the original terminal editor this project pays homage to
  • Built with Go — for its simplicity, static binaries, and cross-platform potential
  • Packaged with WiX Toolset v7 — the gold standard for Windows MSI packaging

Made with ❤️ for developers who live in the terminal — even on Windows.

About

NANO FOR WINDOWS

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages