Changes

Jump to navigation Jump to search
145 bytes added ,  20:28, 27 April 2017
no edit summary
=== 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 they snippets look like this: snippets.context['TRIGGERKEYWORD'] = 'PASTEDTEXT'
-- The first line is mandatory:
snippets.context['emph'] = '{\\em %<selected_text>%0}'
snippets.context['bold'] = '{\\bf %<selected_text>%0}'
snippets.context['start'] = '\\start%1\n\t%0\n\\stop%1' snippets.context['itemize'] = '\\startitemize[packed]\n\t\\startitem\n\t\t%<selected_text>%0\n\t\\stopitem\n\\stopitemize'-- start itemization snippets.context['item'] = '\\startitem\n\t%<selected_text>%0\n\\stopitem'
snippets.context['enumerate'] = '\\startenumerate\n\t%0\n\\stopenumerate'
snippets.context['chapter'] = '\\startchapter[title={%1},marking{%1}]\n\t%0\n\\stopchapter'
**<code>%0</code> set the ''closing'' caret (placeholder) (the cursor will jump here '''last''')
**<code>%1</code> set one or multiple input carets (<code>%1</code>, <code>%2</code>, <code>%3</code> and so on; you can also use the same integer multiple times: e.g. <code>\\start%1 ... \\stop%1</code>)
**<code>%<selected_text></code> this is where highlighted text will be pasted when enclosing it with a snippet (e.g. <code>{\\emph bi %<selected_text>%0}</code>)
* After adding snippets, you have to restart Textadept or reset Lua state as described in Step 4.
*** You can turn off alphabetical sorting of snippets by adding the following line to your <code>init.lua</code>:
TODO * '''Note''' that since this way you added bound snippets.'''context''', i.e. to Textadept's ConTeXt lexer, Textadept's status bar in the lower right corner has to say '''context''', otherwise use a ConTeXt document or see Step 4.2.
* Read more about snippets in Textadept's [https://foicica.com/textadept/api.html#textadept.snippets manual].
=3rd party projects=
A ConTeXt module for textadept Textadept is being developed at [https://github.com/stephengaito/ta-context-latex ta-context-latex].
Note though, that if you plan to use Textadept without LaTeX with ConTeXt mkiv only (recommended), then you might not need the package mentioned above as it comes with literally only a hand full of ConTeXt snippets. It also needs additional software to be installed (Textredux, ctags), so that it's almost more comfortable to create own ConTeXt snippets with the ease of Textadept (see above).
194

edits

Navigation menu