Changes

Jump to navigation Jump to search
695 bytes added ,  12:55, 27 April 2017
m
Changed snippet details
* 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 the a file called <code>init.lua</code>. This is the file and location where you should save all your Textadept 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.
Usually you have to restart Textadept after changing its configuration files. Robert Gieseke created a codethough, which you can add to your <code>init.lua</code> to circumvent reloading of having to restart Textadept, whenever a change is made:
-- Save and reset Lua state: `F9`
keys['f9'] = function() -- Mac OSX users might prefer: keys[OSX and 'mf9' or 'f9']
io.save_file()
reset()
* If for some reason you can't add the folder to PATH, for example on public machines, you have to add the full path to your ConTeXt executables. For example:
textadept.run.compile_commands.tex = 'C:/ctx/tex/texmf-mswin/bin/mtxrun --autogenerate --script context --autopdf --purge --synctex=-1 "%f"'
* '''Important''': you have to start `first-setup.bat` from the main ConTeXt directory every time you restart a machine, on which ConTeXt is not in the Windows search path (see Step 1.3), otherwise you will get ''file not found''-errors, when trying to compile a ConTeXt document.
* '''Note''' that you have to use slash <code>/</code> instead of backslash <code>\</code> in the file path, since Lua (same as ConTeXt) interprets a <code>\</code> as the beginning of a command, while for Windows it doesn't make any difference.
=== Step 4.2: Lexing (command highlighting & code folding) ===
A lexer is a file that defines command highlighting and code folding keywords. Since Textadept comes with an own a ConTeXt lexer, it is a good idea . In order to be able to bind <use command highlighting and code>*.tex</code> files to Textadept's folding when writing ConTeXt lexerdocuments, as otherwise you won't benefit from have to bind those documents to the mentioned features when writing ConTeXt documentslexer. SoTo do so
1. add the following line to your <code>USER/.textadept/init.lua</code> and save it afterwards:
snippets['context'] = snippets['context'] or {}
-- Snippets start here:
snippets.context['emph'] = '{\\em %<selected_text>%0}' snippets.context['bold'] = '{\\bf %<selected_text>%0}'
snippets.context['start'] = '\\start%1\n%0\n\\stop%1'
snippets.context['itemize'] = '\\startitemize\n\t%0\n\\stopitemize'
* The most important formatting commands are the following:
**<code>%0</code> creates a primary input ''closing'' caret (placeholder) (the cursor will jump here first'''last''')**<code>%1</code> creates one or multiple secondary input carets(1, 2, 3 and so on; you can also use the same integer multiple times: e.g. <code>\\start%1 ... \\stop%1</code>)**<code>%\n</code> creates a new line**<code>%\t</code> creates a tab**<code>%<selected_text></code> this is where highlighted text will be pasted when enclosing it with a snippet (e.g. <code>{\\emph %<selected_text>%0}</code>)
* After adding snippets, you have to restart Textadept firstor reset Lua state as described in Step 4.
* You can paste snippets into ConTeXt documents
194

edits

Navigation menu