Text Editors

From Wiki
Jump to navigation Jump to search

You can use any text editor that can save text files in UTF-8 for creating a input file for ConTeXt. Many editors provide generic TeX syntax highlighting, but some have even more support for ConTeXt.

Integrating text editors with ConTeXt

Setting up source synchronisation

Tree-Sitter Parser

A tree-sitter parser is available for ConTeXt:

https://github.com/pmazaitis/tree-sitter-context

....which can be used as a stand-alone tool to parse and inspect ConTeXt files, has libraries for integration into other tools, and can be used with editors and IDEs to provide features such as syntax highlighting, code folding, and symbol extraction.

Editors and IDEs have varying approaches for integrating a Tree-Sitter parser; check the list of integration hints above (and please update the editor pages if you have had some success!).

Language Server Protocol (LSP) Servers

Editors and IDEs may also be able to interface with an LSP to provide more features for editing context code.

LSP projects that claim some support for ConTeXt:

Compiling automatically a document when it changes

entr

The entr tool (available for Linux, BSDs and MacOS) allows to run arbitrary commands when files change. So it can be used to compile automatically a ConTeXt file (or a ConTeXt project) when a source file changes, and thus becoming a great aid when editing a ConTeXt document or project - no matter what text editor you use, you can auto-compile your document or your project every time its source file(s) change on disk.

For example, to tell entr to compile with ConTeXt a file named example.tex every time it changes, you can execute the following:

ls example.tex | entr -s 'mtxrun --script context example.tex'

And it will make ConTeXt to compile your example.tex file every time it changes - or, in other words, every time you save it to disk.

Conversely, you can also compile a ConTeXt project every time a source file in said project changes, by something like

find . -name '*.tex' | entr -s 'mtxrun --script context my_context_project.tex'

To learn more about entr, you can check out its repo in GitHub, its website or its online man page.

LSPs

LSPs may support re-compiling the document.

Text editors

Beware, for several editors, syntax highlighting wasn’t changed since MkII!

Features
C: ConTeXt syntax highlighting (and perhaps command completion)
P: PDF preview
S: SyncTeX support (synchronising between text in PDF and TeX source)
T: ConTeXt typesetting
2: bidirectional editing (right-to-left)
_?: previous feature probable but unsure
OSes
L: Linux
M: MacOS
W: Windows
Editor Features OSes Latest Release Remarks
Atom CSP LMW deprecated in 2022 Replaced by Pulsar; see below.
BBEdit CSTP M 2023 Venerable, powerful text editor for MacOS. Highlighting, section navigation, and code folding available through a language module; typesetting and PDF preview available through an external script.
ConTeXt IDE CP W 2022 The first self-contained IDE for ConTeXt. After a few button presses you can start writing, compiling and viewing. There are some templates provided for new users. It’s a Windows 10 app with 'fluent design' GUI. The editor is based on monaco-editor and the PDF viewer is based on PDF.js.
ConTeXt On Web (COW) CPT Browser 2022 Online IDE with layout and table wizards.
Emacs with AUCTeX CT LMW 2024 Extremely powerful & highly configurable text editor for CTRL- and ALT- key lovers.
The official AUCTeX distribution beginning with 11.50 has ConTeXt support. Further AUCTeX customization for ConTeXt.
If you write documents with bibliographies, indexes, or cross-references, you may also be interested in using Reftex. There is also Emacs-muse which is an extension.
gedit L(MW) 2023 GNOME editor (MATE fork: Pluma); also install the plugins!
Helix C LMW 2024 Modal, character-based text editor supporting ConTeXt with Tree-Sitter and LSPs.
jEdit LMW 2020 Cross-platform mature programmer’s text editor. Good support for TeX (formerly also LilyPond) among the rest.
Kate C LMW 2023 IDE for KDE.
nano L(MW) 2023 Curses-based text editor for Unix and Unix-like systems, designed to be a free replacement for the Pico text editor. Has basic TeX syntax highlighting.
Notepad++ CT?2 W 2023 Npp is one of the most powerful and useful text editors on Windows (you can also use it under Wine). Modern interface with loads of included features (see especially the TextFX menu). ConTeXt support files come with the ConTeXt distribution in directory texmf-context/context/data/npp.
Nova CPT M 2023 Nova is a capable commercial text editor by Panic for MacOS. The editor supports a good set of general text editing features, with additional functionality provided by extensions. A git client, terminal handling, preview, and simple IDE are built in.
Pulsar CSP LMW 2024 Fork of Atom; based on Electron. Good git client. Lots of plugins covering any editing task. Install plugins "language-context-lmtx", "language-lua" and "pdf-view" for C and P.
SciTE CT L(M)W 2023 Used to be the "official" ConTeXt editor (more info). ConTeXt support files come with the ConTeXt distribution in directory texmf-context/context/data/scite. SciTE for Mac is commercial (AppStore). (After API changes, the setup doesn’t work any more.)
Smultron PTU M 2022 Shareware. Old configuration instructions.
Sublime Text CT2 LMW 2021 Uncluttered yet extremely powerful & widely revered text editor. With Package Control, install the vital simple_ConTeXt package (discontinued, not available anymore as of 2021-11; see CudaText for its successor).
TeXlipse PS?T LMW 2020 LaTeX-Extension for Eclipse (part of Eclipse Science)
TeXshop PT M 2023 Simple TeX IDE for OSX. TeXShop
TeXstudio PST LMW 2023 Extensive LaTeX IDE. Too LaTeX-centered to be really helpful for ConTeXt.
Textadept CT LMW 2023 ConTeXt support files come with the ConTeXt distribution in directory texmf-context/context/data/textadept. (Might not work any more, similar problem as with SciTE.)
TextMate C M 2014? The ConTeXt bundle is outdated and not in the distribution, but you can download a copy from GitHub.
TextPad CT W 2023 Commercial; TeX/ConTeXt/LaTeX command library; configurable to run a whatever-TeX command as a tool
TeXWorks PST LMW 2024 Probably the most widespread TeX IDE, similar to TeXshop, supported by TUG. ConTeXt support enhanced in 6/2024; support files in texmf-context/context/data/texworks obsolete.
Vim CT2 LMW 2022 Extremely powerful & highly configurable text editor. It operates in different "modes": you type in text in "insert mode" and pass commands to the editor in "normal mode." Whether you prefer Vim or emacs is a religious question of the highest importance. ConTeXt support is good.
Visual Studio Code / VSCodium C WML 2023 Universal IDE, based on Electron. Usable Git client, lots of plugins. ConTeXt syntax support in the distribution; language server still in development.
WinEdt T W 2023 Shareware. A nice, configurable Windows editor for LaTeX. A large collection of buttons with Greek letters and other (math) symbols is very helpfulp when typesetting math. It also has spell checker. LaTeX users can also find many templates (tables, enumerations, ...) and compiling/previewing the documents by clicking a button. This is supported for ConTeXt also. You can configure it easily.