This project is a lightweight, terminal-based text editor written in Go. It provides a vim-like interface with basic text editing capabilities, search functionality, and file management features. The editor is designed to be efficient and easy to use, making it suitable for quick edits and working in terminal environments.
- Vim-like modal editing (Normal, Insert, Search modes)
- Basic text manipulation (insert, delete, copy, paste)
- File operations (open, save)
- Search functionality with highlighting
- Undo/Redo capabilities
- Line numbering
- Status bar with file and cursor information
- Go 1.16 or higher
- Git
-
Clone the repository:
git clone https://github.com/IvanGael/Go-terminal-editor.git cd Go-terminal-editor
-
Install dependencies:
go get
-
Build the project:
go build -o editor
To start the editor, run:
./editor [filename]
If a filename is provided, the editor will open that file. Otherwise, it will start with a blank document.
i
: Enter Insert modeh
,j
,k
,l
or arrow keys: Move cursorx
: Delete character under cursordd
: Delete current lineyy
: Yank (copy) current linep
: Paste yanked or deleted content/
: Enter Search moden
: Find next occurrenceN
: Find previous occurrenceu
: UndoCtrl+r
: Redo:w
: Save file:q
: Quit (will warn if unsaved changes):q!
: Force quit without saving
Esc
: Return to Normal mode- Any character: Insert at cursor position
Enter
: Insert new lineBackspace
: Delete character before cursor
- Type to enter search term
Enter
: Confirm search and return to Normal modeEsc
: Cancel search and return to Normal mode
The editor uses some default settings that can be modified in the source code:
- Tab size: 4 spaces (adjustable in the
initialModel
function) - Color scheme: Can be modified by changing the ANSI color codes in the
View
function
This project is licensed under the MIT License. See the LICENSE
file for details.
This project uses the following open-source libraries:
- Bubble Tea for terminal UI
- Lip Gloss for styling
- golang.org/x/term for terminal handling