-
Notifications
You must be signed in to change notification settings - Fork 15
Code snippets
Code snippets are simple text snippets where the user can easily replace placeholders in the snippet text. There are two commands for handling snippets. One for creating snippets and another for completing snippets.
Through oi there is a command for creating code snippets. Snippets are located under Languages/[plugin_name]/snippets. The LANGUAGE parameter can either be the name of the language or a file extension supported by the language plugin.
Command
oi snippet-create LANGUAGE SNIPPET_NAME
To use a code snippet use the complete command that will launch the snippet window. The snippet window contains a text box for putting in replacement text for the placeholders and a window showing the completed snippet. Each replacement is written as a word separated by spaces. If the replacement contains a space use quotes around that string. As with snippet-create the LANGUAGE parameter can either be the name of the language or a file extension supported by the language plugin. The indentation parameter decides how the inserted text would be indented. Indentation is represented by t for tab and s for space. If the indentation is two tabs and one space the parameter would be "tts".
Command
oi snippet-complete LANGUAGE SNIPPET_NAME INSERT_TARGET_FILE|LINE|COLUMN INDENTATION