Skip to content

Ax is a code editor with syntax highlighting that runs in your terminal written completely in Swift.

Notifications You must be signed in to change notification settings

engali94/ax-editor

Repository files navigation

AX Editor

A light weigt text editor with syntax highlighting. It is written completly in Swift using ANSI Escape Sequnces. It is still not complete and buggy (work in progress) contributions are warmly welcomed 🙌

enter image description here

Installation

  • Clone and cd into the repository

  • Run swift package generate-xcodeproj

  • Run the following command to try it out:

swift run ax --help

Usage

Opening files in Ax

At the moment, you can open ax editor by using the command

swift run ax

This will open up an empty document.

If you wish to open a file straight from the command line, you can run

swift run ax /path/to/file

To open and edit a file.

Moving the cursor around

You can use the arrow keys to move the cursor around

You can also use:

  • PageUp - Go to the top of the document

  • PageDown - Go to the bottom of the document

  • Home - Go to the start of the current line

  • End - Go to the end of the current line

Editing the file

You can use the keys Backspace and Return / Enter as well as all the characters on your keyboard to edit files!

OAx is controlled via your keyboard shortcuts. Here are the default shortcuts that you can use:

| Keybinding | What it does |

Keybinding What it does
Ctrl + D Exits the the editor.
Ctrl + S Saves the open file to the disk (To be Implemented).
Ctrl + F Searches the document for a search query. Allows pressing of and to move the cursor to the previous occurance fof the query and and to move to the next occurance of the query. Press Return to cancel the search at the current cursor position or Esc to cancel the search and return to the initial location of the cursor. Note: this allows you to use regular expressions. (To be Implemented).
Ctrl + U Undoes your last action. The changes are committed to the undo stack every time you press the space bar, create / destroy a new line and when there is no activity after a certain period of time which can be used to capture points where you pause for thought or grab a coffee etc...
Ctrl + R Redoes your last action. The changes are committed to the undo stack every time you press the space bar, create / destroy a new line and when there is no activity after a certain period of time which can be used to capture points where you pause for thought or grab a coffee etc...
Ctrl + F Allows replacing of occurances in the document. Uses the same keybindings as the search feature: and to move the cursor to the previous occurance fof the query and and to move to the next occurance of the query. You can also press Return, y or Space to carry out the replace action. To exit replace mode once you're finished, you can press Esc to cancel and return back to your initial cursor position. Note: this allows you to use regular expressions.(To be Implemented).
Ctrl + A Carries out a batch replace option. It will prompt you for a target to replace and what you want to replace it with and will then replace every occurance in the document. Note: this allows you to use regular expressions. (To be Implemented).

TODO

  • Basic editing functions

  • Line numbers

  • Undo and Redo

  • Syntax highlighting

  • Loading files

  • Saving files

  • Searching and replacing

  • Command line bar

  • Status bar

  • Config files

  • Tabs for multitasking

  • Auto indentation

  • Prettifier / Automatic code formatter

  • Built In linters

  • Auto brackets

  • Auto complete

  • File tree

  • Start page

Contributing

Contributions are warmly welcomed 🙌

Credits

Thanks to all the authors and contributers of the following tools: ColorizeSwift CrossTerm Ox Editor

Licence

It is released under the MIT license, see Licence

About

Ax is a code editor with syntax highlighting that runs in your terminal written completely in Swift.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages