Skip to content

harunsasmaz/pre-text

Repository files navigation

Pre/text

A Vim-style Text Editor.

Libraries and Preliminaries

  • You may feel the need of checking termios.h to understand raw mode

  • Please check the ASCII Table and its arithmetic before start reading the code

  • Pretext uses VT100 Escape Sequence, Please read the guide here

    • VT100 sequence enables cursor positioning, screen positioning, set/reset mode and many more functionalities in Pretext editor, you will encounter with this sequence frequently.
  • If you are not familiar with variadic functions and callback functions, give a short reading to have an idea.

  • Pretext uses ANSI Escape Codes for coloring

Compile

gcc -o pretext pretext.c

Run

Either with a new file as:

./pretext

Or with an existing file:

./pretext pretext.c

Supported Functionalities

Save / Save as

You can use CTRL + S to save your modifications.

Note that if you are editing a new file, prompt will want you to enter a file name to save.

Find

You can use CTRL + F to do incremental search in the file.

Both forward and backward search are enabled, you can go next and back in search results.

If you are not familiar with incremental search, visit here

Comment

Pretext provides both single-line and multi-line comments.

As usual, you can use "//" for single-line comments and "/*" + "*/" for multi-line comments.

Syntax Highlighting

Pretext supports a basic syntax highlighting in .c, .h and .cpp files. You can notice that strings, numbers and keywords are highlighted in a really simple manner.

When you open a new file, if you save it as one of the mentioned file type, then you will observe that syntax is highlighted.

Also, search results are highlighted.

Quit

Another keyboard shortcut that is enabled in Pretext is CTRL + Q combination. So you can quit from a file as long as all modifications are saved or there is no modification.

If you do modifications in the file and try to quit, Pretext prompts you a notification message to warn you that you have unsaved modifications. You can either press CTRL + F three times to quit without saving or save the modifications and quit at once.

File Information

Pretext shows you the total lines and bytes in file and if you have modifications, then it shows you how many bytes are modified.

Releases

No releases published

Packages

No packages published

Languages