Skip to main content

Introduction

Pragtical has little functionalities without plugins — anything that can be implemented as plugins can and will be implemented as one.

Pragtical is mostly written in Lua. If you want to write plugins, you need to know how to write Lua. There are various resources such as the Lua 5.4 Reference Manual, Programming in Lua, Learn Lua in 15 Minutes, Lua Tutorial at TutorialsPoint and Lua Tutorial at lua-users.org.

You will also need general programming knowledge and some experience with object-oriented programming.

Some of these tutorials target older versions of Lua and may be less relevant.

Overview

Pragtical is a fork of lite. As such, a lot of concepts used in lite is inherited in Pragtical. Lite: An Implementation Overview is an excellent article that explains many concepts about lite.

Types of plugins

There are a few types of plugins. Syntaxes and colors are considered as subset of plugins. These subsets of plugins only interact with the syntax highlighter and the style table respectively.

Tips and tricks

Here are some tips for plugin developers.

Interactive debugging

Other than using GDB to debug the C part of Pragtical, you can also debug the Lua part with lite-debugger. To use the debugger, install it as a plugin and call command.perform "debugger:break" to stop the VM and start debugging interactively.

Differing stack traces on a critical error

On an older version of Pragtical, the stack trace printed on the terminal when a critical error occur may differ with the stack trace printed in error.txt. In this case, the stack trace in error.txt is more complete and should be referred. This is a bug and will be fixed in future versions of Pragtical.

Since v3.2.0, console output works on Windows without the instructions below.

On Windows, we compile Pragtical using the GUI subsystem by default. This causes Pragtical to close the stdout. To work around this behavior, you can force Pragtical to keep stdout open by redirecting its output in a terminal.

On PowerShell:

./pragtical | tee -variable null

On cmd.exe:

./pragtical > NUL