Skip to content
Vadim Dyachenko edited this page Feb 6, 2022 · 3 revisions

GMEdit supports snippets in standard Ace format.

You can access snippet definitions for different editing modes via a dropdown in Preferences.

See Ace repository for examples of snippets for existing languages (.snippets files) or this doc for a general explanation of syntax.

For example, you could add a for-loop snippet by adding

snippet for
	for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
		${5:/* code */}
	}

to snippet definitions. Then you can find your snippet in auto-completion menu, press Tab/Enter to insert it, and use Tab/Shift+Tab to navigate between it's items as you fill them out.

NB! Ace snippet syntax is sensitive to indentation - any snippet should be followed by one or more lines with no indentation, and you should use consistent tab-based indentation (no zero-indent gaps) in the snippets themselves. Enable "Show invisibles" in Ace settings if you are unsure of what you are inserting.

Better workflow:

Syntax extensions:

  • `vals: $v1 $v2` (template strings)
  • #args (pre-2.3 named arguments)
  • ??= (for pre-GM2022 optional arguments)
  • ?? ?. ?[ (pre-GM2022 null-conditional operators)
  • #lambda (pre-2.3 function literals)
  • => (2.3+ function shorthands)
  • #import (namespaces and aliases)
  • v:Type (local variable types)
  • #mfunc (macros with arguments)
  • #gmcr (coroutines)

Customization:

User-created:

Other:

Clone this wiki locally