Open main menu

Changes

6 bytes added ,  13:44, 16 October 2022
no edit summary
[https://github.com/orbitalquark/textadept/ Textadept] is a programmable text editor for Linux, Mac OSX and Windows. It is fully extensible using [https://www.lua.org/ Lua].
= ConTeXt with Textadept (MS Windows) =(updated 2017/12) == Step 1: Install Download & Installation of '''Textadept''' ==
1.1. [https://github.com/orbitalquark/textadept/releases/ Download] and extract Textadept to a folder of your choice.
1.2. Use <code>textadept.exe</code> from the extracted folder to start Textadept.
== Step 2: Tweak Setup of '''Textadept''''s settings ==
'''Note''' that almost all changes All default user settings for Textadept have to Textadept are be saved in the file <code>init.lua</code>. There is are two of them, of which you should edit only one:
* One of them is in the extracted Textadept main folder. It is '''not recommended''' to edit this file as your changes will be lost when you update Textadept. Instead:
* When you start Textadept for the first time, a new folder <code>SYSDRIVE:\users\USERNAME\.textadept</code> gets created. It also contains a file called <code>init.lua</code>. This is the file and location where you should save all your Textadept user settings. This way you can make a copy and use it on several computers. When you open it for the first time it should be empty. == Step 2.1 Create a Hotkey to re-initialize Textadept ==
Usually you have to restart Textadept after changing its configuration files. Robert Gieseke created a code though, which you can add to your <code>init.lua</code> to circumvent having to restart Textadept whenever a change is made:
Save <code>init.lua</code> and restart Textadept once. After doing so you can add changes to Textadept's configuration files and press <code>F9</code>-key afterwards to save and load the changes without having to restart Textadept.
=== Step 2.12: Bind a PDF build command into Textadept ===
2.12.1. Use Textadept to open your <code>init.lua</code> stored in <code>SYSDRIVE:\users\USER\.textadept\</code>.
2.12.2. Add an execute command for ConTeXt to Textadept's menu:
textadept.run.compile_commands.tex = 'mtxrun --autogenerate --script context --autopdf --purge --synctex=-1 "%f"'
* '''Note''' that your ConTeXt executables folder has to be in the Windows search path!
2.12.3. Restart Save and restart or re-init Textadept to reload load the modified <code>init.lua</code>.
2.12.4. Open or create a ConTeXt test document:
\starttext
hello world!
* You will have to save the file with an appropriate ending first, after that it will be recognized as ConTeXt format file automatically.
2.12.5. Use Textadept's '''Tools''' -> '''Compile''' to build a PDF with the options added to <code>init.lua</code>. A message buffer with compilation status will open in a seperate tab.
2.12.6. When you have a popular PDF reader installed already, it should pop up at the end of the process and show the created PDF output. [https://www.sumatrapdfreader.org/free-pdf-reader.html '''Sumatra PDF'''] is highly recommended for this.
=== Step 2.23: Lexing (command highlighting & code folding) ===
A lexer is a file that defines command highlighting and code folding keywords. Textadept comes with a ConTeXt lexer. In order to be able to use command highlighting and code folding when writing ConTeXt documents, you have to bind those documents to the lexer. To do so
2.23.1. add the following line to your <code>USER/.textadept/init.lua</code> and save it afterwards:
textadept.file_types.extensions.tex = 'context'
* If you plan to use LaTeX and ConTeXt, you might want to use different file extensions for each format. For example <code>*.tex</code> for LaTeX and <code>*.cxd</code> for ConTeXt documents. In that case you only have to bind your new ConTeXt extension to Textadept's ConTeXt lexer, since <code>.tex</code> files are automatically recognized as LaTeX documents:
** When linking files within ConTeXt documents without adding an extension though, ConTeXt will expect those files to have the ending <code>*.tex</code>, i.e. you will have to work with filenames and extensions when using a format other than <code>*.tex</code>, which on the other hand should not be seen as a disadvantage.
2.23.2. Restart Textadept to reload <code>init.lua</code>.
2.23.3. Open a ConTeXt document and check Textadept's status bar in the lower right corner. It should say '''context'''. If it says '''latex''' make sure it really is a ConTeXt file or repeat the procedure.
== Optional: Additional '''Textadept''' tweaks ==
=== Themes & editor font changes ===
You can change the theme, font and font size of Textadept with the following line
ui.set_theme('dark', {font = 'Monospace', fontsize = 10}) -- Textadept v9
* There are more settings which you can look up in Textadept's [https://foicica.com/textadept/manual.html#Themes manual].
=== Snippets ===
Snippets are predefined code or text blocks. Using snippets can save a lot of time as you won't have to retype often used commands and text passages. You add snippets to your <code>USER/.textadept/init.lua</code>. In Textadept snippets look like this:
snippets.context['TRIGGERKEYWORD'] = 'PASTEDTEXT'
194

edits