Git Product home page Git Product logo

goedit's Introduction

GoEdit - A bare bones text editor, written in Go

For this project I will be using termbox-go, a minimalistic API for text-based user interfaces.

My objective is to create a simple terminal based text editor, like vi, with the base functionality

Index:

Installation

To start using this editor, first thing you need is to install Go -> golang's official site.

Once Go is installed, go to your terminal clone this repository.

git clone https://github.com/AlejandroSuero/GoEdit

Note: If you don't have git installed, go to -> git's official site or select at the top where it is a green button that says "Code ▼" and next "Download ZIP".

Next, go into the directory where you have it cloned.

# This will initialize the project
go init goedit

# This will download the dependencies
go mod tidy

Finally, you can build the project and start using it.

# For UNIX users
go build -o goedit editor.go
./goedit <path-to-the-file-or-leave-it-empty-for-a-welcome-message>

# For Windows users
go build -o goedit.exe editor.go
.\goedit.exe <path-to-the-file-or-leave-it-empty-for-a-welcome-message>

For now, check the commands and GoEdit those files 🫡

Supported commands

These are the commands which are currently supported.

Note: Commands are case sensitive

Normal mode commands

Command Description
Q Exits the editor
!Q Forces the exit. (Useful if you don't want to write your changes)
w Writes file
i Enters insert mode one character before
I Enters insert mode at the beginning of the line
a Enters insert mode one character after
A Enters insert mode at the end of the line
o Inserts a new line bellow the cursor and enters insert mode
O Inserts a new line on top of the cursor and enters insert mode
j or ArrowDown Moves cursor down n times. Ex: If j is pressed it will move once, if 2 and then j are pressed it will move it twice. Any number is valid, and 2ArrowDown as well
k or ArrowUp Moves cursor up n times. Ex: If k is pressed it will move once, if 2 and then k are pressed it will move twice. Any number is valid, and 2ArrowUp as well
l or ArrowRight Moves cursor right n times. Ex: If l is pressed it will move once, if 2 and then l are pressed it will move twice. Any number is valid, and 2ArrowRight as well
h or ArrowLeft Moves cursor left n times. Ex: If h is pressed it will move once, if 2 and then h are pressed it will move twice. Any number is valid, and 2ArrowLeft as well
PageUp Moves the cursor half a page up
PageDown Moves the cursor half a page down
gg Moves the cursor to the beginning
G Moves the cursor to then end of the file

Insert mode commands

Command Description
<Esc> or <Ctrl>q Exits insert mode
Basic interactions Write any character, insert spaces, tabs, delete characters and add new lines

goedit's People

Contributors

alejandrosuero avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.